本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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();
}