Skip to content Skip to sidebar Skip to footer

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 1:

Actually the color TextView is:

android:textColor="@android:color/tab_indicator_text"

or

#808080

Solution 2:

You can save old color and then use it to restore the original value. Here is an example:

ColorStateListoldColors=  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.

Solution 3:

There are some default colors defined in android.R.color

int c = getResources().getColor(android.R.color.primary_text_dark);

Solution 4:

Get these values from attributes:

int[] attrs = newint[] { android.R.attr.textColorSecondary };
TypedArray a = getTheme().obtainStyledAttributes(R.style.AppTheme, attrs);
DEFAULT_TEXT_COLOR = a.getColor(0, Color.RED);
a.recycle();

Solution 5:

I know it is old but according to my own theme editor with default light theme, default

textPrimaryColor = #000000

and

textColorPrimaryDark = #757575

Post a Comment for "What Is Default Color For Text In Textview?"