【发布时间】:2014-07-04 12:09:50
【问题描述】:
我的一项活动中有一个表格,大约有 10 个无线电组。我的问题是我必须检查是否有一个无线电组没有检查? 我的代码示例如下所示:
<RadioGroup
android:id="@+id/radioq1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<RadioButton
android:id="@+id/q1f"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:text="@string/conffalse"
android:textColor="#f05252" />
<RadioButton
android:id="@+id/q1t"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="60dp"
android:text="@string/conftrue"
android:textColor="#37df47" />
</RadioGroup>
【问题讨论】:
-
你有 10 个单选组或按钮?
-
您应该使用 CheckBox 而不是 RadioButton/RadioGroup?因为您必须检查多个项目。
-
@PurpleDroid 是的,他有上述代码 10 次