I set the color to red , and after that I want to set the color again back to default, but I do not know what is default color, does anyone knows ?
First of all, the default font color (for the Normal style) is not black but Automatic (black on light colors, white on dark colors).
There is no default color defined in HTML. The "default color" is configured in the browser or by the operating system you are using.
In XML, we can set a text color by the textColor attribute, like android:textColor="#FF0000" .
TextView Text Color – To change the color of text in TextView, you can set the color in layout XML file using textColor attribute or change the color dynamically in Kotlin file using setTextColor() method.
Actually the color TextView is:
android:textColor="@android:color/tab_indicator_text"
or
#808080
You can save old color and then use it to restore the original value. Here is an example:
ColorStateList oldColors = textView.getTextColors(); //save original colors textView.setTextColor(Color.RED); .... textView.setTextColor(oldColors);//restore original colors
But in general default TextView
text color is determined from current Theme applied to your Activity
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With