我有一个使用支持库中的AppCompatRadioButtons创建的相当简单的单选按钮组。然而,在Lollipop之前的版本上,该组似乎无法正常工作。我能够选择每个选项,但找不到任何原因。
我正在使用运行4.1的模拟器进行测试。如下所示,我可以选择多个选项。
在Lollipop和Marshmallow上进行测试会得到所需的结果。
我正在使用运行4.1的模拟器进行测试。如下所示,我可以选择多个选项。
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.v7.widget.AppCompatRadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="W"/>
<android.support.v7.widget.AppCompatRadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Q"/>
<android.support.v7.widget.AppCompatRadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="B-Hum"/>
<android.support.v7.widget.AppCompatRadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="B-Sci"/>
<android.support.v7.widget.AppCompatRadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="B-Soc"/>
</RadioGroup>
在Lollipop和Marshmallow上进行测试会得到所需的结果。