8

Is there a way to get the hint color from an EditText?

I need the color to set it as the text color of the EditText too

Marian Klühspies
  • 13,945
  • 14
  • 78
  • 125

3 Answers3

12

I guess you could use this:

final ColorStateList colors = editText.getHintTextColors();
editText.setTextColor(colors);

Note that hint color is actually a ColorStateList.

Tadej
  • 2,871
  • 1
  • 15
  • 23
2

Late response (but worth it). You can use:

<EditText
    ...
    android:textColor="?android:attr/textColorHint" />
RonTLV
  • 2,377
  • 2
  • 22
  • 35
1

You can make use of the getHintTextColors() API. Check this documentation.

AndyFaizan
  • 1,746
  • 19
  • 29