//设置控件高度为宽度的一半//screenWidth 为屏幕的宽度//View为你要设置的控件//LinearLayout.LayoutParams 为这个控件外部的布局 LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) View.getLayoutParams();layoutParams.height = screenWidth / 2;
view.setHeight(100);