diff --git a/src/android/support/design/widget/TextInputLayout.java b/src/android/support/design/widget/TextInputLayout.java index 29266062e..3fb8b6583 100644 --- a/src/android/support/design/widget/TextInputLayout.java +++ b/src/android/support/design/widget/TextInputLayout.java @@ -309,6 +309,7 @@ public class TextInputLayout extends LinearLayout { 0, ViewCompat.getPaddingEnd(mEditText), mEditText.getPaddingBottom()); } } else { + updateEditTextBackground(false); removeView(mErrorView); mErrorView = null; } @@ -364,11 +365,8 @@ public class TextInputLayout extends LinearLayout { .start(); // Set the EditText's background tint to the error color - ViewCompat.setBackgroundTintList(mEditText, - ColorStateList.valueOf(mErrorView.getCurrentTextColor())); - + updateEditTextBackground(true); updateLabelVisibility(true); - } else { if (mErrorView.getVisibility() == VISIBLE) { ViewCompat.animate(mErrorView) @@ -385,15 +383,25 @@ public class TextInputLayout extends LinearLayout { }).start(); // Restore the 'original' tint, using colorControlNormal and colorControlActivated - final TintManager tintManager = TintManager.get(getContext()); - ViewCompat.setBackgroundTintList(mEditText, - tintManager.getTintList(R.drawable.abc_edit_text_material)); + updateEditTextBackground(false); } } sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); } + private void updateEditTextBackground(boolean errorShown) { + if (errorShown && mErrorView != null) { + // Set the EditText's background tint to the error color + ViewCompat.setBackgroundTintList(mEditText, + ColorStateList.valueOf(mErrorView.getCurrentTextColor())); + } else { + final TintManager tintManager = TintManager.get(getContext()); + ViewCompat.setBackgroundTintList(mEditText, + tintManager.getTintList(R.drawable.abc_edit_text_material)); + } + } + /** * Returns the error message that was set to be displayed with * {@link #setError(CharSequence)}, or null if no error was set