Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the text color of the error popup for an EditText?

On ICS, when using a theme based upon android:Theme.Light the text in the error popup when using setError(...) is white, as is the background.

I can fix this issue by adding <item name="android:textColorPrimaryInverse">#ff000000</item> to my theme. While this helps I'm a bit worried that by doing that change some other text, that uses textColorPrimaryInverse will turn from white to black and perhaps not be visible. I would rather just change that attribute for the EditText that displays the popup in question or for just that activity.

Clarification

I would like to change a property, preferably the text color, of the popup that displays the error message when the user enters something wrong into an EditText.

like image 959
Robert Höglund Avatar asked Jan 24 '12 18:01

Robert Höglund


1 Answers

You can do it like this:

editText.setError(Html.fromHtml("<font color='red'>Error Message!</font>"));
like image 73
mostar Avatar answered Nov 10 '22 00:11

mostar