I cannot get the default gray text color for TextView (and maybe other views) in Android 23.
I tried to get it with this code :
TextView textview= (TextView) mActivity.findViewById(R.id.my_textview);
int colorFirstTry = title.getCurrentTextColor(); // black
int colorSecondTry = title.getTextColors().getDefaultColor(); // black
int colorthirdTry = ContextCompat.getColor(mActivity, android.R.color.primary_text_light); // black
My theme is the default theme used in an blank activity project (AppTheme from Theme.AppCompat.Light.DarkActionBar parent). Colors are blue, darker blue and purple for respectively colorPrimary, colorPrimaryDark and colorAccent.
When i navigate through all Theme.AppCompat.Light.DarkActionBar parents, i find a similar gray value :
<style name="Base.V7.Theme.AppCompat.Light" parent="Platform.AppCompat.Light">
...
<item name="colorPrimaryDark">@color/primary_dark_material_light</item>
But this value shoud be overrided by my app theme value.
By default, the color of the text will be black until it is changed.
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" .
As said by Alex here, you can get it by:
android:textColor="@android:color/tab_indicator_text"
or
#808080
It worked great for me!
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