0

Hint color when textInputLayout label floating

Hint color when label is not floating

I want hint color to be same (pink) in both state.

What I am doing

<style name="TextAppearence.App.TextInputLayoutError" 
    parent="TextAppearence.App.TextInputLayout">
    <item name="android:textColor">@color/colorPink</item>
    <item name="android:textColorHint">@color/colorPink</item>
    <item name="android:textSize">15sp</item>
</style>



textinputlayout.setHintTextAppearance(R.style.TextAppearence_App_TextInputLayoutError);
Bhavin Jadav
  • 274
  • 1
  • 3
  • 14

2 Answers2

0

In the TextInputLayout that holds the EditText, add:

android:textColorHint="someColor"

OR

You need to change your style.xml. Because your parent should be like below.

<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
            <!--EditText hint color-->
            <item name="android:textColorHint">@color/default_app_white(This should be your color code)</item>
           <!-- TextInputLayout text color-->
            <item name="colorControlActivated">@color/default_app_green</item>
            <!-- EditText line color when EditText on-focus-->
            <item name="colorControlHighlight">@color/default_app_green</item>
            <!-- EditText line color when EditText  in un-focus-->
            <item name="colorControlNormal">@color/default_app_white</item>
        </style>
Flutterian
  • 1,761
  • 1
  • 21
  • 47
0

Define a color you require in your colors.xml

<color name="colorAccent">#cf376b</color>

Then add the line android:textColorHint="@color/colorAccent" in your android.support.design.widget.TextInputLayout

Like this:

<android.support.design.widget.TextInputLayout
                android:layout_width="match_parent"
                android:textColorHint="@color/colorAccent"
                android:layout_height="wrap_content">

                <android.support.design.widget.TextInputEditText
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="Your Hint" />

            </android.support.design.widget.TextInputLayout>
An08NY
  • 139
  • 15