Valentin
Valentin

Reputation: 5598

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.

Upvotes: 20

Views: 14253

Answers (2)

Valentin
Valentin

Reputation: 5598

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)

Upvotes: 6

OhhhThatVarun
OhhhThatVarun

Reputation: 4321

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"

Upvotes: 59

Related Questions