Error TextInputLayout not fixed when deleting error message

I have a vertical linear layout with some input fields. Using TextInputLayout, I get a nice stream with tags and inline error messages. My problem is when I add and delete error messages.

If I add an error message, it will be placed under the edit text and everything looks good.

If I delete the error message using setError (null), the message will be deleted, but the space is still there. This is apparently for googles design (see https://code.google.com/p/android/issues/detail?id=176005 ). I would really like this space to be removed, as the user interface looks very wrong.

If I do .setErrorEnabled (false), the view is deleted and everything looks fine again. However, if the user changes the data, and I make another setError, the error message is not displayed (only the text edit line is red).

+8
android android-design-library android-textinputlayout
source share
1 answer

According to support library version 23.1.1 (and possibly earlier) this should no longer be. You should be able to call TextInputLayout.setErrorEnabled(false) to hide the TextView error and calling TextInputLayout.setError(error) now internally calls TextInputLayout.setErrorEnabled(true) if the error is not empty or empty. See the code snippet below taken from the support library:

 public void setError(@Nullable CharSequence error) { if (!mErrorEnabled) { if (TextUtils.isEmpty(error)) { // If error isn't enabled, and the error is empty, just return return; } // Else, we'll assume that they want to enable the error functionality setErrorEnabled(true); } ... } 
+20
source share

All Articles