android:layout_weight的真实含义是:一旦View设置了该属性(仅在LinearLayout中有效),那么该 View的宽度等于原有宽度(android:layout_width)加上剩余空间的占比。
Google官方推荐,当使用weight属性时,将width设为0dip即可,效果跟设成wrap_content是一样的。这样weight就可以理解为占比了!
android:layout_weight的真实含义是:一旦View设置了该属性(仅在LinearLayout中有效),那么该 View的宽度等于原有宽度(android:layout_width)加上剩余空间的占比。
Google官方推荐,当使用weight属性时,将width设为0dip即可,效果跟设成wrap_content是一样的。这样weight就可以理解为占比了!