當前位置: 首頁>>代碼示例>>Java>>正文


Java LayoutParams.FILL_PARENT屬性代碼示例

本文整理匯總了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);
	
}
 
開發者ID:woshiwpa,項目名稱:SmartMath,代碼行數:52,代碼來源:ActivityIntegrate.java


注:本文中的android.widget.LinearLayout.LayoutParams.FILL_PARENT屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。