Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I get the default hint color of an EditText?

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

like image 309
Marian Klühspies Avatar asked Mar 18 '14 17:03

Marian Klühspies


2 Answers

I guess you could use this:

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

Note that hint color is actually a ColorStateList.

like image 175
Tadej Avatar answered Oct 04 '22 23:10

Tadej


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

<EditText
    ...
    android:textColor="?android:attr/textColorHint" />
like image 27
RonTLV Avatar answered Oct 04 '22 22:10

RonTLV