RelativeLayout.LayoutParams reParams =(RelativeLayout.LayoutParams) tv_green.getLayoutParams(); //取控件textView当前的布局参数
reParams .height = 30;// 控件的高强制设成30
tv_green.setLayoutParams(reParams ); //使设置好的布局参数应用到控件
另:如果控件在多层view下,则需要通过它父层的view ID来控制
时间: 2024-10-06 16:36:37