I have a fairly simple radio button group created with the AppCompatRadioButtons from the support library. However, the group does not seem to work on pre Lollipop versions. I am able to select every option and cannot find any indication on why it is doing this.
I am testing with an emulator running 4.1. As you can see below I can select multiple options.

<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>
Testing on Lollipop and Marshmallow gets required results.
Define a unique ID for each AppCompatRadioButton. For example:
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.v7.widget.AppCompatRadioButton
android:id="@+id/radio_w"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="W"/>
<android.support.v7.widget.AppCompatRadioButton
android:id="@+id/radio_q"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Q"/>
<android.support.v7.widget.AppCompatRadioButton
android:id="@+id/radio_bhum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="B-Hum"/>
<android.support.v7.widget.AppCompatRadioButton
android:id="@+id/radio_bsci"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="B-Sci"/>
<android.support.v7.widget.AppCompatRadioButton
android:id="@+id/radio_bsoc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="B-Soc"/>
</RadioGroup>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With