Radio button in horizontal and vertical direction in a single radio group
<p>i managed to put radio buttons in horizontal and vertical direction but they are in two radio groups but i want all th radio buttons to be placed inside a single radio group.</p>

<p><a href="https://i.stack.imgur.com/1iszy.png" rel="nofollow noreferrer">My output its look fine</a> But they are in two radio groups,how i achieve this type of layout with single radio group.</p>

<p>xml:</p>

<pre><code>&lt;RelativeLayout 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"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
tools:context="com.example.asad.homebuyerproject.ResidentialFragment"&gt;


&lt;RadioGroup
    android:id="@+id/ReplaceAreaCommercial"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="10dp"
    android:background="#FFFFFF"
    android:layout_marginLeft="10dp"&gt;


    &lt;RadioButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:button="@drawable/hostdrawable" /&gt;

    &lt;RadioButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/Residential"
        android:button="@drawable/houdrawable" /&gt;

    &lt;RadioButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/Residential"
        android:button="@drawable/uilfloor" /&gt;

    &lt;RadioButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/Residential"
        android:button="@drawable/penhoudrawable" /&gt;


&lt;/RadioGroup&gt;


&lt;RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="160dp"
    android:layout_marginStart="160dp"

    &gt;

    &lt;RadioGroup
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"&gt;

        &lt;RadioButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:button="@drawable/fladrawable" /&gt;

        &lt;RadioButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:button="@drawable/vildrawable" /&gt;

        &lt;RadioButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:elevation="0dp"
            android:button="@drawable/studaprtment" /&gt;


    &lt;/RadioGroup&gt;

&lt;/RelativeLayout&gt;
</code></pre>

<p></p>