当前位置: 首页>>代码示例>>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;未经允许,请勿转载。