本文整理汇总了Java中android.widget.LinearLayout.LayoutParams.FILL_PARENT属性的典型用法代码示例。如果您正苦于以下问题:Java LayoutParams.FILL_PARENT属性的具体用法?Java LayoutParams.FILL_PARENT怎么用?Java LayoutParams.FILL_PARENT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.widget.LinearLayout.LayoutParams
的用法示例。
在下文中一共展示了LayoutParams.FILL_PARENT属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: adjustMargin
public void adjustMargin() {
LinearLayout.LayoutParams llayoutParams = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
int nScreenSizeCategory = getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
final float fScale = getResources().getDisplayMetrics().density;
int nScreenOrientation = getResources().getConfiguration().orientation;
int nMargin = 0;
if (nScreenOrientation == Configuration.ORIENTATION_LANDSCAPE) {
if (nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_SMALL
|| nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_NORMAL) {
nMargin = 4;
} else if (nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_LARGE) {
nMargin = 8;
} else {
// xlarge
nMargin = 16;
}
} else {
if (nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_SMALL
|| nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_NORMAL) {
nMargin = 4;
} else if (nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_LARGE) {
nMargin = 12;
} else {
// xlarge
nMargin = 32;
}
}
LinearLayout linearlayoutLevelInput = (LinearLayout)findViewById(R.id.integral_level_input);
LinearLayout linearlayoutExprInput = (LinearLayout)findViewById(R.id.integrated_expr_input);
LinearLayout linearlayoutDxInput = (LinearLayout)findViewById(R.id.dx_input);
LinearLayout linearlayoutDyInput = (LinearLayout)findViewById(R.id.dy_input);
LinearLayout linearlayoutDzInput = (LinearLayout)findViewById(R.id.dz_input);
LinearLayout linearlayoutCalculate = (LinearLayout)findViewById(R.id.integral_calculate_layout);
llayoutParams.setMargins((int)(nMargin * fScale + 0.5f),
(int)(nMargin * fScale + 0.5f),
(int)(nMargin * fScale + 0.5f),
0);
linearlayoutLevelInput.setLayoutParams(llayoutParams);
linearlayoutExprInput.setLayoutParams(llayoutParams);
linearlayoutDxInput.setLayoutParams(llayoutParams);
linearlayoutDyInput.setLayoutParams(llayoutParams);
linearlayoutDzInput.setLayoutParams(llayoutParams);
llayoutParams.setMargins((int)(nMargin * fScale + 0.5f),
(int)(nMargin * fScale + 0.5f),
(int)(nMargin * fScale + 0.5f),
(int)(nMargin * fScale + 0.5f));
linearlayoutCalculate.setLayoutParams(llayoutParams);
}