You need to use StateListDrawable
for this
- A StateListDrawable is a drawable object defined in XML that uses a several different images to represent the same graphic, depending on the state of the object.
SAMPLE CODE
Layout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Hint Text">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/edt_bg"
android:visibility="visible" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Hint Text">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/edt_bg"
android:visibility="visible" />
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
@drawable/edt_bg
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/edt_bg_selected" android:state_focused="true" />
<item android:drawable="@drawable/edt_bg_normal" android:state_focused="false" />
</selector>
@drawable/edt_bg_selected
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:bottom="1dp"
android:left="-3dp"
android:right="-3dp"
android:top="-3dp">
<shape android:shape="rectangle">
<stroke
android:width="2dp"
android:color="#0fe4e4" />
<solid android:color="#00ffffff" />
</shape>
</item>
</layer-list>
@drawable/edt_bg_normal
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:bottom="1dp"
android:left="-3dp"
android:right="-3dp"
android:top="-3dp">
<shape android:shape="rectangle">
<stroke
android:width="2dp"
android:color="#000" />
<solid android:color="#00ffffff" />
</shape>
</item>
</layer-list>
OUTPUT

NOTE
Use android:width="2dp"
and android:color="#000"
as per your requirement to set Thickness width and color of line in your TextInputEditText