1、确保只有LinearLayout控件才能使用weight,如RelativeLayout使用weight是没有用的。 2、设置weight时,要对width生效就把width设置为0dp,要对height生效就把height设置为0dp。