setHintTextColor() in EditText

kartik trivedi picture kartik trivedi · Jun 22, 2011 · Viewed 105.7k times · Source

I have View in which there are two text boxes, and the user can select text color from another view on the same screen (through dialog box).

So when the user changes color via dialog box, I am changing color of EditText text and its hint. But when there is some text is available in EditText after that user selects other color, then that text is coming in that color. But if I remove all that text then the color of HintText is that of the previous color.

For example, currently if I have red color in text box and the user selects green color so text is there in green color. But if I remove that text then hint text are coming in red even if I change hint color in code. This problem only comes when there is some text there. if it is blank and hint text is there then problem is not coming.

Answer

Anand Chavan picture Anand Chavan · May 27, 2012

Simply add this in your layout for the EditText :

android:textColorHint="#FFFFFF"