Om3ga
Om3ga

Reputation: 32823

invisible text on setError() in android

I am using setError() method in EditText in android. It does show the popup but the text is invisible. It seems like text has the same color like its background which is white. I used following code to make it work but still the text is not visible.

int ecolor = 65793;
String estring = "Input is incorrect";
ForegroundColorSpan fgcspan = new ForegroundColorSpan(ecolor);
SpannableStringBuilder ssbuilder = new SpannableStringBuilder(estring);
ssbuilder.setSpan(fgcspan, 0, estring.length(), 0);
customPriceInput.setError(ssbuilder);

How can I make it work?

Upvotes: 1

Views: 1125

Answers (2)

FSRezende
FSRezende

Reputation: 53

private EditText adTitle;
// ....
adTitle.setError(Html.fromHtml("<font color='red'>hello</font>"));

extract from: Changing the look and feel of default .setError("I dont like your pink color");

Upvotes: 5

Tim
Tim

Reputation: 395

http://code.google.com/p/android/issues/detail?id=22920

this worked for me. (the second comment)

"#2 [email protected] Hi,

I was able to reproduce this on my Nexus S running Android 4.0.3.

Here's how I made it work. 1. Create a theme with: @android:color/primary_text_light

2.Apply MyApp theme to my application from manifest."

Upvotes: 0

Related Questions