Android动态设置控件高度
GridView mGrid= (GridView) findViewById(R.id.gridview);
LinearLayout.LayoutParams linearParams = (LinearLayout.LayoutParams) mGrid.getLayoutParams(); // 取控件mGrid当前的布局参数
linearParams.height = 75;// 当控件的高强制设成75象素
mGrid.setLayoutParams(linearParams); // 使设置好的布局参数应用到控件mGrid2
[Java]代码
GridView mGrid= (GridView) findViewById(R.id.gridview);
LinearLayout.LayoutParams linearParams = (LinearLayout.LayoutParams) mGrid.getLayoutParams(); // 取控件mGrid当前的布局参数
linearParams.height = 75;// 当控件的高强制设成75象素
mGrid.setLayoutParams(linearParams); // 使设置好的布局参数应用到控件mGrid2
相关推荐
chenjinlong 2020-01-29
vickyjfr 2013-08-27
luoj 2011-08-17
huohu00 2015-04-22
omguare 2012-05-07
SuperMenyII 2019-06-26
AngelicaA 2011-05-02
AABBbaby 2018-07-27
DrZOU 2017-12-21
wuqiong 2017-04-10
Lzn0 2017-03-27
fengyeezju 2015-12-25
superxlcr 2015-05-27
rookieding 2015-04-22
familynt 2015-04-06
mishaki 2015-02-13
江南以北 2014-12-28
yarkey0 2014-10-22