Search code examples
androidradio-group

Can I reduce the space between radiobuttons in a radiogroup?


This is my .xml file

<RadioGroup
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginStart="@dimen/margin_medium">

    <com.google.android.material.radiobutton.MaterialRadioButton
        android:id="@+id/high_school_answer"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/high_school"/>

    <com.google.android.material.radiobutton.MaterialRadioButton
        android:id="@+id/bachelor_answer"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/bachelor"/>

    <com.google.android.material.radiobutton.MaterialRadioButton
        android:id="@+id/technical_answer"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/technical"/>

    <com.google.android.material.radiobutton.MaterialRadioButton
        android:id="@+id/professional_answer"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/professional"/>

</RadioGroup>

The below screenshot shows how it looks like

So I would like to reduce the vertical space between my radiobuttons.

Screenshot:

enter image description here


Solution

  • Set height to RadioButton android:layout_height="10dp"