1

Extra space in error message

<com.google.android.material.textfield.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/tl_password"
            android:layout_marginEnd="20dp"
            android:layout_marginStart="20dp"
            android:layout_marginBottom="5dp"
            app:errorEnabled="true"
            app:hintEnabled="false"
            app:passwordToggleEnabled="true"> 
<com.google.android.material.textfield.TextInputEditText
                android:id="@+id/etPassword"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:inputType="textPassword"
                android:drawableStart="@drawable/ic_password_key"
                android:drawablePadding="15dp"/>
 </com.google.android.material.textfield.TextInputLayout>

Need exactly as below Image.

enter image description here

Akarsh M
  • 1,629
  • 2
  • 24
  • 47

1 Answers1

1

Just use attribute: app:startIconDrawable="@drawable/ic_search_bottom_app"

Use this:

 <com.google.android.material.textfield.TextInputLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Label"
        app:errorEnabled="true"
        app:startIconDrawable="@drawable/ic_search_bottom_app">

        <com.google.android.material.textfield.TextInputEditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
    </com.google.android.material.textfield.TextInputLayout>
Sumit Shukla
  • 4,116
  • 5
  • 38
  • 57