What is android default color for disabled text in edittext?

12.8k views Asked by At

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.

2

There are 2 answers

1
Nitesh Singh On

Hello Misagh, You can get the hint color using following ways :

 1. final ColorStateList colors = editText.getHintTextColors();
     editText.setTextColor(colors);`
  1. Color code is : #808080 (R-128, G-128, B-128)

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.

3
Dima On

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%.