[TextInputLayout] Error message not shown after calling setError
See original GitHub issueDescription:
Even though error is enabled, TextInputLayout
doesn’t display the error message after setting it. Only the outline (box) is affected.
I have to call requestLayout()
on my TextInputLayout
to make the error message show up. This shouldn’t be the case.
After calling requestLayout()
:
Expected behavior:
Calling setError
should make the error message show up
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:
- Created 4 years ago
- Reactions:6
- Comments:8 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.hi, I have same problem and fix it by change
android:layout_height=“wrap_content” of TextInputLayout