<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="6"
tools:context=".MainActivity" >
<Button
android:text="BTN1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="fill_vertical"
android:layout_weight="1" />
<Button
android:text="BTN2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="fill_vertical"
android:layout_weight="2" />
<Button
android:text="BTN3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="fill_vertical"
android:layout_weight="1" />
<Button
android:text="BTN4"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="fill_vertical"
android:layout_weight="1" />
<Button
android:text="BTN5"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="fill_vertical"
android:layout_weight="1" />
</LinearLayout>
使用android:layout_height="match_parent"
只是拉伸按钮将整个屏幕的高度。我希望按钮2的宽度是其他按钮的两倍。
缩小文字大小android:textSize =“10dp”。减少所有按钮的文字大小 – Raghunandan 2013-05-13 18:18:34
@Raghunandan这不是一个可接受的解决方案。我想保留所有内容,文本大小,颜色,重量,按钮顺序,按钮2,在这种情况下,我希望它匹配同一行上其他按钮的高度 – ilomambo 2013-05-13 18:20:38
然后它不会认为它是可能的。以及我很好奇,并期待更好的解决方案 – Raghunandan 2013-05-13 18:22:10