本文整理匯總了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);
}