I want to align my radio buttons in front of each other. My radio buttons are in the radio group and my parent layout is a constraint layout.
How to do that? I tried by putting the radio group into a child relative layout but it's not working. I want to align my radio buttons in front of each other.
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<EditText
android:id="@+id/mValidity"
android:layout_width="match_parent"
android:layout_height="wrap_content"[In image you can see get now radio button is below the shop now radio button. but i want get now radio button will be in right of hop now.][1]
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/mLink"
app:layout_constraintVertical_bias="0.000" />
<RadioGroup
android:id="@+id/lRadioGroup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/mValidity"
app:layout_constraintVertical_bias="0.000">
<RadioButton
android:id="@+id/mShopNow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:onClick="checkButton"
android:text="SHOP NOW" />
<RadioButton
android:id="@+id/mGetNow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="checkButton"
android:text="GET NOW" />
</RadioGroup>
<TextView
android:id="@+id/mDealType"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Deal Type"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/lRadioGroup"
app:layout_constraintVertical_bias="0.000" />
<Button
android:id="@+id/btn"
android:layout_width="match_parent"
android:layout_height="50dp"
android:onClick="addNote"
android:text="Insert Document"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/mDealType"
app:layout_constraintVertical_bias="0.035" />
</androidx.constraintlayout.widget.ConstraintLayout>