material-components-android
material-components-android copied to clipboard
[TextInputEditText] Hint color and Cursor color do not update when the parent TextInputLayout goes to Error state
Description:
As shown in the image below, the hint color and cursor color do not update to the error color when the parent TextInputLayout is in the error state. Instead, the cursor color is still set to colorPrimary (the blue), and the hint color is still set to colorOnSurface (the light gray).
Expected behavior: When in an error state, the hint color and cursor color should update to be the same as the boxBorderColor as shown in the interactive demo from the Material Text Field docs.
Source code: XML:
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/email_input_layout"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/email"
app:layout_constraintBottom_toTopOf="@id/unimportant_layout"
app:layout_constraintTop_toBottomOf="@id/other_unimportant_layout">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/email_input_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress" />
And then at some point in the Fragment:
binding.emailInputLayout.error = "Empty field"
Android API version: 31
Material Library version: 1.6.0
Device: Google Pixel 6
From the doc I think the hint color is correct (it shouldn't change itself to colorError.)
But the cursor color should be changed.
Hi, is this issue still open? I would like to work on it if possible.