我有三个单选按钮,我想均匀地将它们放在屏幕上。当我使用android:layout_weight="1"
时,按钮在屏幕上延伸出来。那么我怎么能在它们之间有相同数量的空间,这些空间也可以在不同的屏幕尺寸上进行缩放?如何在Android中均匀分隔出单选按钮?
<RadioGroup
android:id="@+id/auton_bar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="10dp"
android:layout_below="@id/clear_fields"
>
<RadioButton
android:id="@+id/auton_radio_1"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="@drawable/auton_col"
android:layout_weight="1"
/>
<!-- android:layout_marginRight="380dp" -->
<RadioButton
android:id="@+id/auton_radio_2"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="@drawable/auton_col"
android:layout_weight="1"
/>
<RadioButton
android:id="@+id/auton_radio_3"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="@drawable/auton_col"
android:layout_weight="1"
/>
</RadioGroup>
谢谢,它的工作,但由于某些原因'layout_weight'参数使我的RadioButtons长两倍。 http://i.imgur.com/7PZfm1j.png 它们通常只有这一宽度的一半。 – rasen58 2013-03-15 23:16:10
你应该使'auton_co1'成为一个可缩放的位图。答案是用示例编辑 – 2013-03-16 05:29:44
@ rasen58将单选按钮的'android:layout_width'设置为'0dp' – Henry 2013-03-16 05:34:29