1 | initial version |
You can achieve this by creating a custom shape drawable resource file and setting it as the background of the EditText.
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- Remove the default border -->
<solid android:color="@android:color/transparent" />
<stroke android:width="0dp" />
<!-- Add the underline -->
<stroke android:width="2dp"
android:color="@color/colorAccent" />
</shape>
<EditText
android:id="@+id/myEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/custom_edittext" />