Reputation: 3674
I want to set hint color in EditText
as disabled text color. So I am using android:textColorHint
attribute. But I don't know how to do that:
android:textColorHint="@android:color/???" // what should I select?
//OR
android:textColorHint="?android:attr/???" // what should I select?
Edit: I can define the same color in values but I want to reference it to handle future changes.
Upvotes: 6
Views: 13117
Reputation: 1510
You can find answer in documentation
https://material.google.com/style/color.html#color-text-background-colors
For dark text on light backgrounds, apply the following opacity levels:
The most important text has an opacity of 87%.
Secondary text, which is lower in the visual hierarchy, has an opacity of 54%.
Text hints (like those in text fields and labels) and disabled text have even lower visual prominence with an opacity of 38%.
Upvotes: 10
Reputation: 328
Hello Misagh, You can get the hint color using following ways :
1. final ColorStateList colors = editText.getHintTextColors();
editText.setTextColor(colors);`
You can go through this documantation : http://developer.android.com/reference/android/widget/TextView.html#getHintTextColors%28%29
Please let me know , If having any problem.
Upvotes: 5