How can I set the padding between the divider line
and the error text
(marked with the question mark in the image) in a TextInputLayout
? I tried adding the padding in the style specified as errorTextAppearance
but it had no effect.
EDIT: Here's the layout:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="test.textinputlayouttest.MainActivity">
<android.support.design.widget.TextInputLayout
android:id="@+id/address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:errorEnabled="true"
app:errorTextAppearance="@style/Error">
<EditText
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter address"
android:inputType="textEmailAddress"
android:padding="26dp"/>
</android.support.design.widget.TextInputLayout>
</android.support.constraint.ConstraintLayout>
and the style:
<style name="Error" parent="TextAppearance.AppCompat">
<item name="android:textColor">@color/red</item>
<item name="android:paddingBottom">300dp</item>
</style>
if you need padding only between the divider line
and the error text
use the previous example just change
android:padding="26dp"
to - > android:layout_marginBottom="20dp"
<android.support.design.widget.TextInputLayout
android:id="@+id/usernameWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:layout_marginBottom="20dp"
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:hint="Username"/>
</android.support.design.widget.TextInputLayout>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With