question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[TextInputLayout] Error message not shown after calling setError

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:6
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
somesh-basicxcommented, Oct 16, 2019

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.

1reaction
h-toloucommented, Apr 19, 2022

hi, I have same problem and fix it by change
android:layout_height=“wrap_content” of TextInputLayout

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android TextInputLayout is not showing error - Stack Overflow
I am using EditText with TextInputLayout. This is the code, that I am using to display error. Once I entered a valid input...
Read more >
TextInputLayout setError() will not show an error after it is ...
When setError ("some text here") is called on a TextInputLayout for the first time, the error is shown properly. If the error is...
Read more >
TextInputLayout | Android Developers
Returns the error message that was set to be displayed with setError(CharSequence) , or null if no error was set or if error...
Read more >
Android TextInputLayout Example | DigitalOcean
To display the error text, we'll have to call the method setError(String) on an instance of TextInputLayout in our MainActivity.java class ...
Read more >
Implement Form Validation (Error to EditText) in Android
<? xml version = "1.0" encoding = "utf-8" ?> ... Here for the instance of the EditText class, setError() is to be called....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found