<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/public_line"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/Public"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="6"
android:text="Public"
android:layout_marginLeft="16dp"
android:layout_marginTop="24dp"
android:textSize="20dp"
android:textColor="@android:color/black"/>
<RadioButton
android:id="@+id/public_button"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="16dp"
android:layout_marginTop="24dp"
/>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginBottom="8dp"
android:text="league is visible to the public,
that is, anyone can join your league"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/Private"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="6"
android:text="Private"
android:layout_marginLeft="16dp"
android:layout_marginTop="24dp"
android:textSize="20dp"
android:textColor="@android:color/black"/>
<RadioButton
android:id="@+id/private_button"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="16dp"
android:layout_marginTop="24dp"
/>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginBottom="8dp"
android:text="Only people with invite code can join"
/>
</RadioGroup>
<TextView
android:layout_alignParentBottom="true"
android:background="@drawable/orange_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Done"
android:padding="16dp"
android:textSize="20dp"
android:textColor="@android:color/black"
android:layout_weight="1"
android:gravity="center"/>
</RelativeLayout>
Here is my layout. It allows both the radio buttons to be selected. Can someone help me figure out what the problem is? From what I know the problem is that the radio buttons are not directly in the radio group, but how am I supposed to accommodate them in the radio group directly to get this same layout. Else is there an alternate way to solve the problem