当前位置: 首页>>代码示例>>Java>>正文


Java FrameLayout.setLayoutParams方法代码示例

本文整理汇总了Java中android.widget.FrameLayout.setLayoutParams方法的典型用法代码示例。如果您正苦于以下问题:Java FrameLayout.setLayoutParams方法的具体用法?Java FrameLayout.setLayoutParams怎么用?Java FrameLayout.setLayoutParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.FrameLayout的用法示例。


在下文中一共展示了FrameLayout.setLayoutParams方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateView

import android.widget.FrameLayout; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

	LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);

	FrameLayout fl = new FrameLayout(getActivity());
	fl.setLayoutParams(params);

	final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources()
			.getDisplayMetrics());

	TextView v = new TextView(getActivity());
	params.setMargins(margin, margin, margin, margin);
	v.setLayoutParams(params);
	v.setLayoutParams(params);
	v.setGravity(Gravity.CENTER);
	v.setBackgroundResource(R.drawable.background_card);
	v.setText("CARD " + (position + 1));

	fl.addView(v);
	return fl;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:SuperAwesomeCardFragment.java

示例2: initDialog

import android.widget.FrameLayout; //导入方法依赖的package包/类
private void initDialog() {
    contentLayout = new FrameLayout(activity);
    contentLayout.setLayoutParams(new ViewGroup.LayoutParams(WRAP_CONTENT, WRAP_CONTENT));
    contentLayout.setFocusable(true);
    contentLayout.setFocusableInTouchMode(true);
    //contentLayout.setFitsSystemWindows(true);
    dialog = new Dialog(activity);
    dialog.setCanceledOnTouchOutside(false);//触摸屏幕取消窗体
    dialog.setCancelable(false);//按返回键取消窗体
    dialog.setOnKeyListener(this);
    dialog.setOnDismissListener(this);
    Window window = dialog.getWindow();
    if (window != null) {
        window.setGravity(Gravity.BOTTOM);
        window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        //AndroidRuntimeException: requestFeature() must be called before adding content
        window.requestFeature(Window.FEATURE_NO_TITLE);
        window.setContentView(contentLayout);
    }
    setSize(screenWidthPixels, WRAP_CONTENT);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:BaseDialog.java

示例3: onAttachedToWindow

import android.widget.FrameLayout; //导入方法依赖的package包/类
/**
 * 向rewardlayout中添加MAX_GIFT_COUNT个子framelayout
 */
@Override
protected void onAttachedToWindow() {
    super.onAttachedToWindow();
    for (int i = 0; i < MAX_GIFT_COUNT; i++) {
        View child = getGiftView();
        child.measure(
                View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),
                View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
        MarginLayoutParams lp = (MarginLayoutParams) child
                .getLayoutParams();
        int height = child.getMeasuredHeight() + lp.topMargin
                + lp.bottomMargin;
        FrameLayout linearLayout = new FrameLayout(mContext);
        FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, height);
        linearLayout.setLayoutParams(params);
        addView(linearLayout);
    }
}
 
开发者ID:Yuphee,项目名称:RewardLayout,代码行数:22,代码来源:RewardLayout.java

示例4: onCreateLoadViewHolder

import android.widget.FrameLayout; //导入方法依赖的package包/类
@Override
public LoadViewHolder onCreateLoadViewHolder(ViewGroup parent) {
    FrameLayout frameLayout = new FrameLayout(parent.getContext());
    frameLayout.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.CENTER));

    Button loadMoreButton = new Button(frameLayout.getContext());
    //if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) loadMoreButton.setTextAppearance(android.support.design.R.style.Widget_AppCompat_Button_Borderless);
    loadMoreButton.setText(R.string.load_more);
    loadMoreButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            loadIfNeeded();
        }
    });
    frameLayout.addView(loadMoreButton);

    ProgressBar loadingProgressBar = new ProgressBar(frameLayout.getContext());
    frameLayout.addView(loadingProgressBar);

    TextView noMoreResultsTextView = new TextView(frameLayout.getContext());
    noMoreResultsTextView.setGravity(Gravity.CENTER);
    noMoreResultsTextView.setText(R.string.no_more_results);
    frameLayout.addView(noMoreResultsTextView);

    return new LoadViewHolder(frameLayout, loadMoreButton, loadingProgressBar, noMoreResultsTextView);
}
 
开发者ID:ShreckYe,项目名称:SCUYouth,代码行数:27,代码来源:ContentListItemAdapter.java

示例5: wrapTabAndBadgeInSameContainer

import android.widget.FrameLayout; //导入方法依赖的package包/类
private void wrapTabAndBadgeInSameContainer(final BottomBarTab tab) {
    ViewGroup tabContainer = (ViewGroup) tab.getParent();
    tabContainer.removeView(tab);

    final FrameLayout badgeContainer = new FrameLayout(getContext());
    badgeContainer.setLayoutParams(new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));

    badgeContainer.addView(tab);
    badgeContainer.addView(this);

    tabContainer.addView(badgeContainer, tab.getIndexInTabContainer());

    badgeContainer.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        @SuppressWarnings("deprecation")
        @Override
        public void onGlobalLayout() {
            badgeContainer.getViewTreeObserver().removeGlobalOnLayoutListener(this);
            adjustPositionAndSize(tab);
        }
    });
}
 
开发者ID:A-Miracle,项目名称:QiangHongBao,代码行数:23,代码来源:BottomBarBadge.java

示例6: createBodyOnDomThread

import android.widget.FrameLayout; //导入方法依赖的package包/类
WXComponent createBodyOnDomThread(WXDomObject dom) {
  if (mWXSDKInstance == null) {
    return null;
  }
  WXDomObject domObject = new WXDomObject();
  WXDomObject.prepareGod(domObject);
  mGodComponent = (WXVContainer) WXComponentFactory.newInstance(mWXSDKInstance, domObject, null);
  mGodComponent.createView(null, -1);
  if (mGodComponent == null) {
    if (WXEnvironment.isApkDebugable()) {
      WXLogUtils.e("rootView failed!");
    }
    //TODO error callback
    return null;
  }
  FrameLayout frameLayout = (FrameLayout) mGodComponent.getHostView();
  ViewGroup.LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
  frameLayout.setLayoutParams(layoutParams);
  frameLayout.setBackgroundColor(Color.TRANSPARENT);

  WXComponent component = generateComponentTree(dom, mGodComponent);
  mGodComponent.addChild(component);
  mRegistry.put(component.getRef(), component);
  return component;
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:26,代码来源:WXRenderStatement.java

示例7: redrawCurrentStationLineIcons

import android.widget.FrameLayout; //导入方法依赖的package包/类
private void redrawCurrentStationLineIcons(Station station) {
    curStationIconsLayout.removeAllViews();
    List<Line> lines = new ArrayList<>(station.getLines());
    Collections.sort(lines, new Comparator<Line>() {
        @Override
        public int compare(Line l1, Line l2) {
            return l1.getName().compareTo(l2.getName());
        }
    });

    for (Line l : lines) {
        Drawable drawable = ContextCompat.getDrawable(getContext(), Util.getDrawableResourceIdForLineId(l.getId()));
        drawable.setColorFilter(l.getColor(), PorterDuff.Mode.SRC_ATOP);

        int height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 30, getResources().getDisplayMetrics());
        FrameLayout iconFrame = new FrameLayout(getContext());
        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(height, height);
        int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5, getResources().getDisplayMetrics());
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
            params.setMarginEnd(margin);
        }
        int marginTop = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, getResources().getDisplayMetrics());
        params.setMargins(0, marginTop, margin, 0);
        iconFrame.setLayoutParams(params);
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
            iconFrame.setBackgroundDrawable(drawable);
        } else {
            iconFrame.setBackground(drawable);
        }
        curStationIconsLayout.addView(iconFrame);
    }
}
 
开发者ID:gbl08ma,项目名称:underlx,代码行数:33,代码来源:HomeFragment.java

示例8: onCreateViewHolder

import android.widget.FrameLayout; //导入方法依赖的package包/类
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
	FrameLayout view = new FrameLayout(parent.getContext());
	view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));

	return new RecyclerView.ViewHolder(view) {
	};
}
 
开发者ID:intik,项目名称:overflow-pager-indicator,代码行数:9,代码来源:MainActivity.java

示例9: setNoMore

import android.widget.FrameLayout; //导入方法依赖的package包/类
public View setNoMore(final int res) {
    FrameLayout container = new FrameLayout(getContext());
    container.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    LayoutInflater.from(getContext()).inflate(res, container);
    getEventDelegate().setNoMore(container);
    return container;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:RecyclerArrayAdapter.java

示例10: PokeListView

import android.widget.FrameLayout; //导入方法依赖的package包/类
public PokeListView(PokeListActivity activity) {
    FrameLayout parent = new FrameLayout(activity);
    parent.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    view = LayoutInflater.from(activity).inflate(R.layout.activity_pokelist, parent, true);
    ButterKnife.bind(this, view);
    this.context = activity;

    initView();
    listener();
}
 
开发者ID:alicanozkara,项目名称:PokemonCards,代码行数:11,代码来源:PokeListView.java

示例11: onCreate

import android.widget.FrameLayout; //导入方法依赖的package包/类
public void onCreate() {
    LinearLayout llPage = new LinearLayout(getContext());
    llPage.setBackgroundColor(-657931);
    llPage.setOrientation(1);
    this.activity.setContentView(llPage);
    this.llTitle = new TitleLayout(getContext());
    int resId = R.getBitmapRes(getContext(), "title_back");
    if (resId > 0) {
        this.llTitle.setBackgroundResource(resId);
    }
    this.llTitle.getBtnBack().setOnClickListener(this);
    resId = R.getStringRes(getContext(), "multi_share");
    if (resId > 0) {
        this.llTitle.getTvTitle().setText(resId);
    }
    this.llTitle.getBtnRight().setVisibility(0);
    resId = R.getStringRes(getContext(), SportPlanFragment.COURSE_STATUS_FINISH);
    if (resId > 0) {
        this.llTitle.getBtnRight().setText(resId);
    }
    this.llTitle.getBtnRight().setOnClickListener(this);
    this.llTitle.setLayoutParams(new LayoutParams(-1, -2));
    llPage.addView(this.llTitle);
    FrameLayout flPage = new FrameLayout(getContext());
    LayoutParams lpFl = new LayoutParams(-1, -2);
    lpFl.weight = 1.0f;
    flPage.setLayoutParams(lpFl);
    llPage.addView(flPage);
    PullToRefreshView followList = new PullToRefreshView(getContext());
    followList.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
    flPage.addView(followList);
    this.adapter = new FollowAdapter(followList);
    this.adapter.setPlatform(this.platform);
    followList.setAdapter(this.adapter);
    this.adapter.getListView().setOnItemClickListener(this);
    ImageView ivShadow = new ImageView(getContext());
    resId = R.getBitmapRes(getContext(), "title_shadow");
    if (resId > 0) {
        ivShadow.setBackgroundResource(resId);
    }
    ivShadow.setLayoutParams(new FrameLayout.LayoutParams(-1, -2));
    flPage.addView(ivShadow);
    followList.performPulling(true);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:45,代码来源:FollowListPage.java

示例12: createVHForRefreshComponent

import android.widget.FrameLayout; //导入方法依赖的package包/类
private ListBaseViewHolder createVHForRefreshComponent(int viewType) {
  FrameLayout view = new FrameLayout(getContext());
  view.setBackgroundColor(Color.WHITE);
  view.setLayoutParams(new FrameLayout.LayoutParams(1, 1));
  view.setVisibility(View.GONE);
  return new ListBaseViewHolder(view, viewType);
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:8,代码来源:BasicListComponent.java

示例13: onCreate

import android.widget.FrameLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  FrameLayout content = new FrameLayout(this);
  content.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
    ViewGroup.LayoutParams.MATCH_PARENT));
  content.setId(R.id.container);
  setContentView(content);
}
 
开发者ID:mapbox,项目名称:mapbox-plugins-android,代码行数:10,代码来源:SingleFragmentActivity.java

示例14: onCreateViewHolder

import android.widget.FrameLayout; //导入方法依赖的package包/类
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    if (viewType == LOAD_MORE_TYPE) {
        mViewContainer = new FrameLayout(parent.getContext());
        mViewContainer.setLayoutParams(DEFAULT_VIEW_LAYOUT_PARAMS);
        return new ViewHolder(mViewContainer);
    }
    return mDelegateAdapter.onCreateViewHolder(parent, viewType);
}
 
开发者ID:Sunzxyong,项目名称:PullToLoad,代码行数:10,代码来源:RecyclerViewAdapterWrapper.java

示例15: setError

import android.widget.FrameLayout; //导入方法依赖的package包/类
public View setError(final int res) {
    FrameLayout container = new FrameLayout(getContext());
    container.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    LayoutInflater.from(getContext()).inflate(res, container);
    getEventDelegate().setErrorMore(container);
    return container;
}
 
开发者ID:ynztlxdeai,项目名称:TextReader,代码行数:8,代码来源:RecyclerArrayAdapter.java


注:本文中的android.widget.FrameLayout.setLayoutParams方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。