0

This is a gender check button.

I want to deploy like this

<EditText
      android:id="@+id/txtSex"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginRight="29dp"
      android:layout_weight="1"
      android:ems="10"
      android:inputType="textPersonName"
      android:text=""/>
AskNilesh
  • 67,701
  • 16
  • 123
  • 163
eggham0518
  • 121
  • 1
  • 7

4 Answers4

4

Try this way

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:orientation="horizontal">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Select Gender" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="10dp"
        android:orientation="vertical">

        <RadioGroup
            android:layout_width="250dp"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:orientation="horizontal">

            <RadioButton
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="5dp"
                android:text="Male" />

            <RadioButton
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="5dp"
                android:text="Female" />

        </RadioGroup>

        <View
            android:layout_width="250dp"
            android:layout_height="2dp"
            android:background="@android:color/black" />

    </LinearLayout>
</LinearLayout>

OUTPUT

enter image description here

AskNilesh
  • 67,701
  • 16
  • 123
  • 163
0

It looks to me like you just want a line underneath your RadioGroup. Just use a View with a height of 1dp and a background color.

Gavin Wright
  • 3,124
  • 3
  • 14
  • 35
0

To achieve this type of UI takes Two Radio button horizontally. after take View set height according to bottom line height. and put it to vertically of both radio buttons.

VIISHRUT MAVANII
  • 11,410
  • 7
  • 34
  • 49
0

if you need only underline below the RadioButton then there is no need to put it in edittext. just put the view as shown below,

 <View
    android:layout_width="100dp"
    android:layout_height="1dp"
    android:layout_marginTop="10dp"
    android:background="#ccc" />
Vivek Makwana
  • 166
  • 3
  • 13