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


Java LayoutParams.setMargins方法代码示例

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


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

示例1: addTab

import android.widget.RelativeLayout.LayoutParams; //导入方法依赖的package包/类
protected void addTab(int index, CharSequence text, int iconResId) {
    TabView tabView = new TabView(this, getContext(), text);
    tabView.setIndex(index);
    tabView.setFocusable(true);
    tabView.setOnClickListener(this.mTabClickListener);
    if (iconResId != 0) {
        tabView.setCompoundDrawablesWithIntrinsicBounds(iconResId, 0, 0, 0);
    }
    int width = this.mMeanWidth == -1 ? getTabWidth(text) : this.mMeanWidth;
    if (this.mMeanWidth != -1) {
        tabView.setSize(this.mMeanWidth, UIsUtils.dipToPx(38.0f));
    } else {
        tabView.setSize(width, UIsUtils.dipToPx(38.0f));
    }
    RelativeLayout relativeLayout = new RelativeLayout(this.mContext);
    relativeLayout.setGravity(17);
    relativeLayout.setLayoutParams(new LayoutParams(-2, UIsUtils.dipToPx(38.0f)));
    LayoutParams params = new LayoutParams(-2, UIsUtils.dipToPx(38.0f));
    params.setMargins(TAB_MARGIN, 0, TAB_MARGIN, 0);
    tabView.setLayoutParams(params);
    relativeLayout.addView(tabView);
    if (this.mIsHome) {
        ThemeDataManager.getInstance(this.mContext).setContentTheme(tabView, ThemeDataManager.NAME_TOP_NAVIGATION_COLOR);
    }
    ImageView imageView = new ImageView(this.mContext);
    LayoutParams imageViewParams = new LayoutParams(width, UIsUtils.dipToPx(2.0f));
    imageViewParams.setMargins(TAB_MARGIN, UIsUtils.dipToPx(36.0f), TAB_MARGIN, 0);
    imageView.setLayoutParams(imageViewParams);
    relativeLayout.addView(imageView);
    imageView.setBackgroundDrawable(getResources().getDrawable(2130838177));
    if (this.mIsHome) {
        ThemeDataManager.getInstance(this.mContext).setShapeSelectorViewTheme(imageView, ThemeDataManager.NAME_TOP_NAVIGATION_COLOR, 2, true);
    }
    this.mTabLayout.addView(relativeLayout);
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:36,代码来源:ChannelTabPageIndicator.java

示例2: addMirrorView

import android.widget.RelativeLayout.LayoutParams; //导入方法依赖的package包/类
private ImageView addMirrorView(ViewGroup parent, RecyclerView recyclerView, View view) {
    view.destroyDrawingCache();
    view.setDrawingCacheEnabled(true);
    ImageView mirrorView = new ImageView(recyclerView.getContext());
    Bitmap bitmap = Bitmap.createBitmap(view.getDrawingCache());
    mirrorView.setImageBitmap(bitmap);
    view.setDrawingCacheEnabled(false);
    int[] locations = new int[2];
    view.getLocationOnScreen(locations);
    int[] parenLocations = new int[2];
    recyclerView.getLocationOnScreen(parenLocations);
    LayoutParams params = new LayoutParams(bitmap.getWidth(), bitmap.getHeight());
    params.setMargins(locations[0], (locations[1] - parenLocations[1]) + UIsUtils.dipToPx(44.0f), 0, 0);
    parent.addView(mirrorView, params);
    return mirrorView;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:17,代码来源:ChannelFragmentAdapter.java

示例3: getPageBody

import android.widget.RelativeLayout.LayoutParams; //导入方法依赖的package包/类
private LinearLayout getPageBody() {
    this.llBody = new LinearLayout(getContext());
    this.llBody.setId(2);
    int resId = R.getBitmapRes(this.activity, "edittext_back");
    if (resId > 0) {
        this.llBody.setBackgroundResource(resId);
    }
    this.llBody.setOrientation(1);
    LayoutParams lpBody = new LayoutParams(-2, -2);
    lpBody.addRule(5, this.llTitle.getId());
    lpBody.addRule(3, this.llTitle.getId());
    lpBody.addRule(7, this.llTitle.getId());
    if (!this.dialogMode) {
        lpBody.addRule(12);
    }
    int dp_3 = R.dipToPx(getContext(), 3);
    lpBody.setMargins(dp_3, dp_3, dp_3, dp_3);
    this.llBody.setLayoutParams(lpBody);
    this.llBody.addView(getMainBody());
    this.llBody.addView(getSep());
    this.llBody.addView(getPlatformList());
    return this.llBody;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:24,代码来源:EditPage.java

示例4: initView

import android.widget.RelativeLayout.LayoutParams; //导入方法依赖的package包/类
private void initView() {
    if (!this.dialogMode) {
        RelativeLayout mainRelLayout = (RelativeLayout) findViewByResName("mainRelLayout");
        LayoutParams lp = (LayoutParams) mainRelLayout.getLayoutParams();
        lp.setMargins(0, 0, 0, 0);
        lp.height = -1;
        mainRelLayout.setLayoutParams(lp);
    }
    initTitleView();
    initBodyView();
    initImageListView();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:13,代码来源:EditPage.java


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