-1

How to customize the underline of EditText as shown below?

enter image description here

K Neeraj Lal
  • 6,768
  • 3
  • 24
  • 33
Mithun Kumar
  • 595
  • 1
  • 9
  • 18

1 Answers1

4

You can do something like this

    <EditText
            android:id="@+id/editRemarks"
            android:layout_below="@+id/addNoteRemarks"
            android:gravity="left"
            android:layout_centerHorizontal="true"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:background="@drawable/edit_text_shape"/>

and below is the drawable file "edit_text_shape"

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
    <shape android:shape="rectangle">
        <!-- Draw a 2dp width border around shape -->
        <stroke
            android:color="@color/viewfinder_laser"
            android:width="2dp"
            />
    </shape>
</item>
<!-- Overlap the left, top and right border using background color  -->
<item
    android:bottom="2dp"
    >
    <shape android:shape="rectangle">
        <solid android:color="@color/white"/>
    </shape>
</item>

Akash Dubey
  • 1,508
  • 17
  • 34