把 android:layout_width="0dp", android:layout_weight="1"
横向分三等分
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="Button" />
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="Button" />
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="Button" />
android:weight属性使用时基本上是把width或者height设为0dp,这样控件便会按照weight值得比例分配大小,比如将上例子中的第一个button的weight设为2,三个空间宽度比例就成了2:1:1