I have 4 radio buttons
and i can only align them vertically and horizontally alignment like this:
A B C D
and
A
B
C
D
but I want is this kind alignment:
A B
C D
is there any possible way to do this?, I can't find any right tutorials or examples.
Use LinearLayout within Radiogroup Like this:
<RadioGroup
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/radioGroup">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RadioButton
android:id="@+id/radioButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New RadioButton"
android:layout_marginLeft="5dp"/>
<RadioButton
android:id="@+id/radioButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New RadioButton"
android:layout_marginRight="5dp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RadioButton
android:id="@+id/radioButton4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New RadioButton"
android:layout_marginLeft="5dp"/>
<RadioButton
android:id="@+id/radioButton3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New RadioButton"
android:layout_marginRight="5dp"/>
</LinearLayout>
</RadioGroup>
RadioGroup extends android.widget.LinearLayout so it is not possible. If you want them in a grid use the appropriate layout but you have to do the whole logic of selecting only one item and so on on your own
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