1

In Android's widget TextInputLayout the style of active error and hint is identical, like thisenter image description here

But when error is on, I want to see different color of hint (black, not red). How can I achieve this?

P.S. I've already tried to apply style programmatically with method .setHintTextAppearance(R.style.StyleName) but it didn't bring any effect

The code of TextInputLayout

<android.support.design.widget.TextInputLayout
        android:id="@+id/editTextClient"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:textColorHint="@color/colorPrimaryText"
        app:errorEnabled="true"
        app:hintEnabled="true"
        android:hint="@string/login"
        app:errorTextAppearance="@style/ErrorAppearence" 
        app:hintTextAppearance="@style/TextLabel"
       app:helperTextTextAppearance="@style/TextAppearance.AppCompat.Body2">

    <android.support.design.widget.TextInputEditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:inputType="text"
            android:textSize="14sp"
            android:singleLine="true"
            android:textColor="@color/colorPrimaryText"/>
</android.support.design.widget.TextInputLayout>

Styles

<style name="TextLabel" parent="TextAppearance.Design.Hint">
    <item name="android:textColor">@color/colorPrimaryText</item>
    <item name="android:textSize">12sp</item>
</style>

<style name="ErrorAppearence">
    <item name="android:textColor">@color/colorAccent</item>
    <item name="android:textSize">12sp</item>
</style>
AlexF
  • 387
  • 1
  • 4
  • 20
  • Possible duplicate of [How to set TextInputLayout error message colour?](https://stackoverflow.com/questions/33709066/how-to-set-textinputlayout-error-message-colour) – Stanislav Bondar Nov 12 '18 at 12:04
  • This seems awfully hard with the recent design libs. Any luck? – Tim Jul 23 '19 at 15:08

0 Answers0