Reputation: 2503
I want to change the title color of actionbar to white. I have declared on styles:
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<item name="android:windowActionBar">true</item>
<item name="android:actionBarStyle">@style/ProjActionBar</item>
<item name="android:actionBarTabTextStyle">@style/ProjActionBar.TitleTextStyle</item>
</style>
<!-- ActionBar Style -->
<style name="ProjActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">@color/b</item>
<item name="android:backgroundStacked">@color/k1</item>
<!-- This is when tabs are splitted into a second line -->
</style>
<style name="ProjActionBar.TitleTextStyle" parent="@android:style/TextAppearance">
<item name="android:textColor">@color/w</item>
<item name="android:textSize">13sp</item>
</style>
As you can see I have a "actionBarTabTextStyle" declared with the attribute "textColor" to @color/w declared in my colors.xml as:
<color name="w">#FFFFFFFF</color>
What happend? why the actionbar title does not change textColor?
My project is targeted to min SDK 11 sdkVersion 17 (Honeycomb 3.0+)
Upvotes: 0
Views: 5982
Reputation: 9872
The problem is that you have not actually changed the title text style. You have changed the style of the tab text. To change the title text style, you want to set android:titleTextStyle
and optionally android:subtitleTextStyle
on your ProjActionBar
style.
So, your ProjActionBar
becomes this:
<style name="ProjActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">@color/b</item>
<item name="android:backgroundStacked">@color/k1</item>
<item name="android:titleTextStyle">@style/ProjActionBar.TitleTextStyle</item>
</style>
Please note that this assumes you are using the native ActionBar components (as indicated by the fact that you are inheriting from @android:style/Widget.Holo.Light.ActionBar
). If you want backwards compatibility, you will have to inherit your style from Widget.AppCompat.Light.ActionBar
and use textStyle
instead of android:textStyle
.
Upvotes: 6