强势插入代码:
//获取屏幕高宽
DisplayMetrics metric = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metric);
windowsHeight = metric.heightPixels;
windowsWight = metric.widthPixels;
//动态改变布局
RelativeLayout linearLayout = (RelativeLayout)findViewById(R.id.linearn1);
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams)linearLayout.getLayoutParams();
layoutParams.height = 110;
linearLayout.setLayoutParams(layoutParams);
注意: 控件布局必须是 RelativeLayout..