Error message text for TextInputLayout is cut off

The error message text gets cut off if you are setting the error on a TextInputLayout more than once. So every time you are setting TextInputLayout error message text, just set it to null first.

textInputLayout.setError(null); textInputLayout.setErrorEnabled(false);
textInputLayout.setError("Error Message");


Layout inspector preview of TextInputLayout

Views hierarchy

Layout Inspector shows that even if there is some space for the error it doesn't draw view in all of it. Everything there is in LinearLayouts (and one simple FrameLayout) so there is no way something would overlap it, paddings are set to 0, there is no code changing height or something suspicious in the implementation, so I don't know what might be a reason of such behaviour.

Although I've found some solution which works. You need to find in TextInputLayout a view holding error (with id textinput_error) and add some small padding to it. I've done it by extending TextInputLayout and adding such code into init.

val errorTV = findViewById<TextView>(R.id.textinput_error)
errorTV.updatePadding(top = 4)

There is already issue on issue tracker - https://issuetracker.google.com/issues/116747167 so lets hope Google will fix it some day.