0

Hello I am trying to put these radio buttons in Radio Group but the problem I run into is they dont stay the way I want. I am attaching this picture to show you 2 different radio buttons which are not in radio groups as of now, but as soon as I put this in radio groups they come in vertical, I would like to use Radio Group to get these 2 radio button side by side with some space between them, but can't seem to find a way.

I want to get these result when doing radio group. I tried Orientation but still no help.

enter image description here

Any help would be appreciated.

Mansi
  • 981
  • 3
  • 9
  • 28
  • Does this answer your question? [button needs to fill parent radiobutton](https://stackoverflow.com/questions/8071027/button-needs-to-fill-parent-radiobutton) – ADM Feb 01 '21 at 05:43
  • use orientation, it will works – Babul Feb 01 '21 at 06:02

2 Answers2

1

try this

<RadioGroup
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <androidx.appcompat.widget.AppCompatRadioButton
                android:layout_width="0dp"
                android:layout_weight="1"
                android:layout_height="wrap_content" />

            <androidx.appcompat.widget.AppCompatRadioButton
                android:layout_width="0dp"
                android:layout_weight="1"
                android:layout_height="wrap_content" />

  </RadioGroup>
Shashank
  • 121
  • 6
0

You could add orientation on your RadioGroup. For example:

<RadioGroup
   android:id="@+id/radio_group"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content" 
   android:orientation='horizontal'>
Stoyan Milev
  • 574
  • 2
  • 13