Skip to content Skip to sidebar Skip to footer

Which Theme Attribute Changes The Text Color Of An Edittext's Error Message

In my form I use setError('') on an EditText field. My Application-Theme extends android:Theme.Holo. I have manually set an image with a dark background for android:errorMessageBac

Solution 1:

You can change the text color by using HTML Font Tag.

But for customizing background color, you should make your own custom pop up. For more information, Kindly go through this link:- How to write style to error text of EditText in android?

Solution 2:

You can try this one:

editText.setError(Html.fromHtml("<fontcolor='red'>Error Message!</font>"));

Solution 3:

do following in manifest.xml

<resources><stylename="LightErrorFix"parent="@android:style/Theme.Light"><itemname="android:textColorSecondaryInverse">@android:color/secondary_text_light</item></style></resources>

Solution 4:

Assuming you did sth like this:

EditTexttext= (EditText) findViewById(R.id.myedittext);

you can do the following:

text.setTextColor(Color.parseColor("#FFFFFF"));

or

text.setTextColor(Color.rgb(200,0,0));

or if you want/need alpha:

text.setTextColor(Color.argb(0,200,0,0));

Anyhow, you should specify your colors in your color.xml (wayyy better to be maintained):

<colorname="myColor">#f00</color>

and then use it like this:

text.setTextColor(getResources().getColor(R.color.myColor));

Have fun :)

Solution 5:

set the property android:textColorPrimaryInverse="YourCOLOR" to the color nedded.

Post a Comment for "Which Theme Attribute Changes The Text Color Of An Edittext's Error Message"