diff --git a/lib/java/com/google/android/material/textfield/TextInputLayout.java b/lib/java/com/google/android/material/textfield/TextInputLayout.java index 2f664d8fb7f..c87ac1534f1 100644 --- a/lib/java/com/google/android/material/textfield/TextInputLayout.java +++ b/lib/java/com/google/android/material/textfield/TextInputLayout.java @@ -4577,7 +4577,10 @@ private void updateCursorColor() { Drawable cursorDrawable = DrawableCompat.wrap(editText.getTextCursorDrawable()).mutate(); if (isOnError() && cursorErrorColor != null) { - color = cursorErrorColor; + int defaultCursorErrorColor = cursorErrorColor.getDefaultColor(); + int targetCursorErrorColor = cursorErrorColor.getColorForState( + editText.getDrawableState(), defaultCursorErrorColor); + color = ColorStateList.valueOf(targetCursorErrorColor); } cursorDrawable.setTintList(color); }