Use the following drawable
as horizontal line (extracted from https://stackoverflow.com/a/21555379/3027124)
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle" >
<solid android:color="@android:color/darker_gray" />
<padding android:bottom="1dp"/>
</shape>
</item>
<item>
<shape android:shape="rectangle" >
<solid android:color="@android:color/white" />
</shape>
</item>
</layer-list>
And set the background to EditText
in xml as
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:text="User Name" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="User Name"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:background="@drawable/horizonal_line"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:text="Password" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:background="@drawable/horizonal_line"/>
</LinearLayout>
Hope this helps.