我有多个单选按钮,我想使用表格进行布局,但也将它们包含在一个单独的无线电组中.我有以下xml布局:
<RadioGroup android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/Group1">
<TableLayout android:id="@+id/RadioButtons"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TableRow>
<RadioButton android:id="@+id/rad1"
android:text="RButton1"
android:layout_width="105px"
android:layout_height="wrap_content"
android:textSize="13px"></RadioButton>
<RadioButton android:id="@+id/rad2"
android:text="RButton2"
android:layout_width="105px"
android:textSize="13px"
android:layout_height="wrap_content"></RadioButton>
<RadioButton android:id="@+id/rad3"
android:text="RButton3"
android:layout_width="105px"
android:textSize="13px"
android:layout_height="wrap_content"></RadioButton>
</TableRow>
</TableLayout>
</RadioGroup>
Run Code Online (Sandbox Code Playgroud)
但不幸的是,表格中的单选按钮似乎忽略了它们在RadioGroup标签内部的事实,因此您可以选择多个单选按钮.我注意到通过移除表格并只有单选按钮它可以正常工作.我怎么能克服这个?它会像在桌子内而不是外面宣布无线电组一样简单吗?谢谢你的帮助.
| 归档时间: |
|
| 查看次数: |
11141 次 |
| 最近记录: |