I am trying to create a text field layout similar to material design - error user input, but I am facing an issue with the hint color. The Material Design guidance states the hint color for a light theme should be
Hint and helper text: #000000 with 38% opacity
which made me add <item name="android:textColorHint">@color/hint_color</item>
to my AppTheme
and <color name="hint_color">#61000000</color>
to my colors.xml
.
However, the hint color always the same as my <item name="colorAccent">@color/accent</item>
(part of AppTheme
) which is currently set to light blue.
So how can I fix this? I have tried to set the hint color directly on the TextInputLayout
and AppCompatEditText
but no luck.
Thanks,
Lars
Found the solution:
xmlns:app="http://schemas.android.com/apk/res-auto"
is defined in your layoutapp:hintTextAppearance="@style/TextAppearence.TextInputLayout.Light.Hint"
Define the style in your styles.xml
<style name="TextAppearence.TextInputLayout.Light.Hint" parent="@android:style/TextAppearance">
<item name="android:textColor">@color/textinput_hint_light_color</item>
<item name="android:textSize">16sp</item></style>
Finally define the color <color name="textinput_hint_light_color">#61000000</color>
in your colors.xml
(38% of 255 converted to hex is 61)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments