Reputation: 370
I want to get something like this
So I want a divider that divides the two radio buttons knowing the fact that Radio Group is a child class of Linear Layout with default oreintation set to vertical However If I do so. It is not happening. below is my tried xml code :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/bottomSheet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="20dp"
android:paddingEnd="20dp"
android:paddingTop="24dp"
android:paddingBottom="16dp"
android:background="@drawable/bottom_sheet_back"
app:layout_behavior="@string/bottom_sheet_behavior">
<TextView
android:id="@+id/txtBottomNeft"
.... />
<ImageView
android:id="@+id/imgBottomNeft"
... />
<RadioGroup
android:id="@+id/radioGroup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtBottomNeft"
android:layout_marginTop="32dp"
android:orientation="vertical">
<RadioButton
android:id="@+id/radioIndian"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:fontFamily="@font/lato"
android:text="Indian Citizen"
android:textColor="#2B2E33"
android:textSize="16sp" />
<View
android:layout_width="match_parent"
android:layout_height="0.3dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="14dp" />
<RadioButton
android:id="@+id/radioForeign"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/lato"
android:text="Foreign/Dual Passport Holder"
android:textColor="#2B2E33"
android:textSize="16sp" />
</RadioGroup>
<LinearLayout
...">
<Button
..../>
<Button
..../>
</LinearLayout>
</RelativeLayout>
Upvotes: 1
Views: 100
Reputation: 292
You can just add a background color to your view between the buttons
<View
android:layout_width="match_parent"
android:layout_height="0.3dp"
android:background="@android:color/black"
android:layout_marginTop="16dp"
android:layout_marginBottom="14dp" />
To make it shorter add margin to the right and left. Here are also some other options.
Upvotes: 1