Android动态设置控件高度

learningITwell 2011-03-30

GridView mGrid= (GridView) findViewById(R.id.gridview); 
LinearLayout.LayoutParams linearParams = (LinearLayout.LayoutParams) mGrid.getLayoutParams(); // 取控件mGrid当前的布局参数
linearParams.height = 75;// 当控件的高强制设成75象素
mGrid.setLayoutParams(linearParams); // 使设置好的布局参数应用到控件mGrid2
 

相关推荐

sgafdsg / 0评论 2011-01-24