Search code examples
androidcolorstextviewdefaultandroid-gui

What is default color for text in textview?


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 ?


Solution

  • 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.