Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: TextInputLayouts always have an error icon

I have noticed that since a few days, all my TextInputLayouts have the "error exclamation point" always enabled. I haven't changed anything about those TextInputLayouts for a long time, so I really don't understand what is happening.

Here is a screenshot of how it looks:

Do you have have any idea what could be the source of this issue? Did something recently changed with the TextInputLayouts?

Thank you very much in advance

EDIT

Here is the related code: The .xml file is really simple. It's a list of TextInputLayouts and EditTexts like this:

<com.google.android.material.textfield.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="@dimen/default_margin"
    android:layout_marginTop="@dimen/default_margin"
    android:layout_marginRight="@dimen/default_margin">

    <com.google.android.material.textfield.TextInputEditText
        android:id="@+id/txtAddressTitle"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="@string/PROFILE_SCREEN_ADDRESS_INPUT_TITLE"
        android:inputType="textPersonName|textCapWords" />

</com.google.android.material.textfield.TextInputLayout>

Also, there absolutely no mention of setError() in my Kotlin code.

like image 303
Valentin Avatar asked Sep 02 '19 07:09

Valentin


2 Answers

You can try this. But It will permanently remove the error Icon. If you want to show it again you have do it programmatically.

app:errorIconDrawable="@null"
like image 148
OhhhThatVarun Avatar answered Sep 21 '22 11:09

OhhhThatVarun


Edit: It looks like it's fixed with com.google.android.material:material:1.2.0-alpha04.


Ho, I found the issue. I actually updated the version of the Material library from version com.google.android.material:material:1.1.0-alpha08 to com.google.android.material:material:1.1.0-alpha09.

Google changed the behaviour of Text Field (see here: https://github.com/material-components/material-components-android/releases/tag/1.1.0-alpha09):

Text Field:

  • Adding option to set TextInputLayout icons to be not checkable (6a88f2b)
  • Implementing error icon for text fields (3f73804)
like image 22
Valentin Avatar answered Sep 23 '22 11:09

Valentin