I'm developing an app and I want to change the textcolor of the actionbar title
. now, I defined a theme in my manifest:
<application
android:theme="@style/AppTheme">
</application>
which is defined in styles.xml:
<style name="AppTheme" parent="android:style/Theme.Holo.Light">
<item name="android:textViewStyle">@style/AppTheme.TextView</item>
<item name="android:actionBarStyle">@style/AppTheme.ActionBarStyle</item>
</style>
<style name="AppTheme.ActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar">
<item name="android:titleTextStyle">@style/AppTheme.ActionBar.TitleTextStyle</item>
</style>
<style name="AppTheme.ActionBar.TitleTextStyle" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">@color/themeapp</item>
</style>
<style name="AppTheme.TextView" parent="@android:style/Widget.TextView">
<item name="android:textColor">#FFFFFF</item>
</style>
this doesn't work but I don't get why. this should work according to this answer.neither the textview style is working.
what I am doing wrong?
UPDATE: changed to meet Grace Feng answer below
in your style. xml in values folder this will change your action bar color.. Replace #666666 with your selected color code for title background color and replace #000000 for your title text color.
Open your device's Settings app . Text and display. Select Color correction. Turn on Use color correction.
Step 1: After opening the android studio and creating a new project with an empty activity. Step 2: Navigate to res/values/colors. xml, and add a color that you want to change for the status bar.
Using SpannableString
we can set Text Color of Actionbar title
SpannableString s = new SpannableString(title);
s.setSpan(new ForegroundColorSpan(Color.GREEN), 0, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
getSupportActionBar().setTitle(s);
<style name="AppTheme" parent="android:style/Theme.Holo.Light">
<style name="AppTheme.TextView" parent="android:Widget.TextView">
You missed a symbol "@" here?
<style name="MyTheme" parent="@android:style/Theme.Holo.Light">
also
<style name="AppTheme.TextView" parent="@android:Widget.TextView">
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