0
I have a layout with 6 Radiobuttons.
They are both horizontal and vertical.
How can I solve this problem? Since using 3 Radiogroups, I can’t uncheck the radio button outside the group. As such, I can score up to 3 Radiobuttons, but it should only be one marked.
How to resolve in layout or programmatically. Thank you
Follows layout:
<RadioGroup
android:id="@+id/radiogroup_map1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:orientation="horizontal">
<RadioButton
android:id="@+id/rb_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:buttonTint="@color/branco"
android:text="Case 1"
android:textColor="@color/branco" />
<RadioButton
android:id="@+id/rb_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:buttonTint="@color/branco"
android:text="Case 2"
android:textColor="@color/branco" />
</RadioGroup>
<RadioGroup
android:id="@+id/radiogroup_map2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:orientation="horizontal">
<RadioButton
android:id="@+id/rb_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:buttonTint="@color/branco"
android:text="Case 3"
android:textColor="@color/branco" />
<RadioButton
android:id="@+id/rb_4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:buttonTint="@color/branco"
android:text="Case 4"
android:textColor="@color/branco" />
</RadioGroup>
<RadioGroup
android:id="@+id/radiogroup_map3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:orientation="horizontal">
<RadioButton
android:id="@+id/rb_5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:buttonTint="@color/branco"
android:text="Case 5"
android:textColor="@color/branco" />
<RadioButton
android:id="@+id/rb_6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="35dp"
android:buttonTint="@color/branco"
android:text="Case 6"
android:textColor="@color/branco" />
</RadioGroup>
Do you want a Radiogroup with 6 Radiobuttons arranged in 3 lines of 3? If yes see this reply
– ramaral
@ramaral would be this, I managed using several groups, but using several groups, I can not leave only 1 radiobutton marked, can be up to 3, need that only 1 is marked. I’ll see the answer
– Henrique
You are doing it the hard way, just use the margin features of each Radio Button and you get this effect ;)
– Ronaldo Araújo