Material-components-android: [TextInputLayout] Error message not shown after calling setError

Created on 19 Jul 2019  路  6Comments  路  Source: material-components/material-components-android

Description:
Even though error is enabled, TextInputLayout doesn't display the error message after setting it. Only the outline (box) is affected.
image

I have to call requestLayout() on my TextInputLayout to make the error message show up. This shouldn't be the case.

After calling requestLayout():
image

Expected behavior:
Calling setError should make the error message show up
image

Source code:
I simply set the error by calling setError.

layoutPassword.error = "error_field_required"`

Android API version: 28

Material Library version: 1.1.0-alpha08

bug

Most helpful comment

Same happens with me. I use setError inside TextWatcher and no matter what I do the error never appears. The funny thing is the same logic is working in my Java project and not with Kotlin project. Also if I press the password toggle button it shows the error but not when I call setError. Please fix this issue on priority it beed more than 3 months since this issue is reported.

All 6 comments

Hi, what version of Android Studio are you using?

Hello @doilio I use 3.4.2

Same happens with me. I use setError inside TextWatcher and no matter what I do the error never appears. The funny thing is the same logic is working in my Java project and not with Kotlin project. Also if I press the password toggle button it shows the error but not when I call setError. Please fix this issue on priority it beed more than 3 months since this issue is reported.

Can you provide a sample app with the issue happening? I'm not able to reproduce it on my end

@leticiarossi I'm not able to reproduce the problem anymore.

Will close this for now then. Feel free to reopen with a sample app if the issue arises again!

Was this page helpful?
0 / 5 - 0 ratings