【发布时间】:2013-05-24 13:40:08
【问题描述】:
我正在尝试制作图片中的RadioGroup。我希望一次只检查一个RadioButton。
这就是我为实现这一目标所做的。
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<RadioButton
android:id="@+id/radio1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/radio1" />
<RadioButton
android:id="@+id/radio2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/radio2" />
</RadioGroup>
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<RadioButton
android:id="@+id/radio3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/radio3" />
<RadioButton
android:id="@+id/radio4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/radio4" />
</RadioGroup>
</RadioGroup>
这是图片
但是通过使用它,我可以从每一行中选择任何一个,即可以选择 2 个项目。 像这样:
请帮帮我...
【问题讨论】:
-
在这里查看我的答案:stackoverflow.com/questions/37313559/…
标签: android radio-button radio-group