android weight 属性正解

要正确使用weight,不要再去纠结 

android:layout_width="match_parent"

 android:layout_width="wrap_content" 两种情况下该如何设置weight. 因为这样设置根本就是错误的用法.

正确的用法是:

先设置 android:layout_width="0dp" 或者 android:layout_height="0dp"

然后再去调配权重

而此时的weight也非常好理解: weight就是比重!比例!请看下图

android weight 属性正解:[2]android
android weight 属性正解:[2]android
android weight 属性正解:[2]android

猜你喜欢

转载自blog.csdn.net/leansmall/article/details/80071231