Reputation: 33
I've created text input using TextInputLayout
and TextInputEditText
.
TextInputLayout
should have gray background and editText
line should be on the bottom without any margin. I tried with 0 margins and padding, but I didn't manage how to do that.
How it looks like:
What I need:
Upvotes: 0
Views: 1271
Reputation: 365048
Just use the standard TextInputLayout
in the Material Components library.
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Hint">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Text"/>
</com.google.android.material.textfield.TextInputLayout>
Upvotes: 2
Reputation: 16
Create a drawable file bg_edittext.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<stroke android:width="1dp" android:color="#000"/>
</shape>
</item>
<item android:bottom="1dp">
<shape android:shape="rectangle">
<solid android:color="#fff"/>
</shape>
</item>
</layer-list>
and go to your edittext, set
android:background="@drawable/bg_edittext"
Upvotes: 0