Change TextInputEditText Hint Color


Answer :

The fix for me was to set the hint and the textColor on TextInputLayout, rather than on TextInputEditText as described here: https://material.io/develop/android/components/text-input-layout/

    <android.support.design.widget.TextInputLayout         android:id="@+id/passwordTextInputLayout"         android:hint="@string/add_nitrogen_template_name_label"         android:textColorHint="@color/warm_grey">          <android.support.design.widget.TextInputEditText             android:textAppearance="@style/TextAppearance.Regular"             android:textColor="@color/white"/>     </android.support.design.widget.TextInputLayout> 

have you tried also these attributes for your AppTheme?

<item name="colorControlNormal">@color/primary</item> <item name="colorControlHighlight">@color/warm_grey</item>       <item name="colorControlActivated">@color/warm_grey</item> 

or moving

android:textColorHint="@color/warm_grey" 

from XML widget to EditTextBaseStyle


You can use the app:hintTextColor and the android:textColorHint attributes in your layout:

<com.google.android.material.textfield.TextInputLayout     app:hintTextColor="@color/mycolor"     android:textColorHint="@color/text_input_hint_selector"     .../> 

or you can define them in a custom style:

<style name="..." parent="Widget.MaterialComponents.TextInputLayout.FilledBox">     <!-- The color of the label when it is collapsed and the text field is active -->     <item name="hintTextColor">@color/my_color</item>      <!-- The color of the label in all other text field states (such as resting and disabled) -->     <item name="android:textColorHint">@color/my_selector_color</item> </style> 

Comments

Popular posts from this blog

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Can Feynman Diagrams Be Used To Represent Any Perturbation Theory?