Change TextInputLayout focused & unfocused hint color programmatically

You can do like this.

android:textColorHint="#FF0000" was EditText's hint color.

If you want the text color as well as the hint color.

You can change android:textColor="#FF0000" in the EditText.

You can add app:errorTextAppearance="@style/text_in_layout_error_hint_Style" to change the error text color.

<com.example.viveka.snipeid.CustomTextInputLayout
    android:id="@+id/input_layout_name"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="15dp"
    android:textColorHint="#FF0000"
    app:errorTextAppearance="@style/text_in_layout_error_hint_Style"
    app:hintTextAppearance="@style/text_in_layout_hint_Style"
    app:errorEnabled="true">

    <EditText
        android:id="@+id/editEmail"
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:layout_marginLeft="-4dp"
        android:digits="[email protected]"
        android:hint="email / snipe id"
        android:textAllCaps="false"
        android:textColor="#FF0000"
        android:textColorHint="@color/primary"
        android:textSize="12sp"/>
</com.example.viveka.snipeid.CustomTextInputLayout>

The LEFT-TOP hint color depended on app:hintTextAppearance="@style/text_in_layout_hint_Style".

And the style code:

<style name="text_in_layout_hint_Style">
    <item name="android:textColor">#FF0000</item>
    <item name="android:textSize">12sp</item>
</style>

Add error text style

 <style name="text_in_layout_error_hint_Style">
    <item name="android:textColor">#00ff00</item>
    <item name="android:textSize">12sp</item>
</style>

like this: enter image description here Hope to help you.