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
  • 15,824
  • 16
  • 93
  • 136

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,901
  • 1
  • 17
  • 23
3

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

<EditText
    ...
    android:textColor="?android:attr/textColorHint" />
RonTLV
  • 2,376
  • 2
  • 24
  • 38
1

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

AndyFaizan
  • 1,833
  • 21
  • 30