Search code examples
androidactionbarsherlockandroid-theme

Change Android Actionbar subtitle colour


I wish to customize the actionBar of my android application.
I am using Actionbar Sherlock.
My min target sdk is 14, target sdk 17.
I have a theme that changes the background colour and main title text
however i cannot change the subtitle text colour
my style is shown here

<style name="MyTheme" parent="@android:style/Theme.Holo.Light">
    <item name="android:actionBarStyle">@style/MyTheme.ActionBarStyle</item>
</style>

<style name="MyTheme.ActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar">
    <item name="android:titleTextStyle">@style/MyTheme.ActionBar.TitleTextStyle</item>
    <item name="android:background">#8B0000</item>
</style>

<style name="MyTheme.ActionBar.TitleTextStyle" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
    <item name="android:textColor">#FFFFFF</item>

</style>

<style name="MyTheme.ActionBar.Subtitle" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Subtitle">
    <item name="android:textColor">#FF0000</item>

</style>


what have a done wrong?


Solution

  • Just change titleTextStyle to subtitleTextStyle

    <style name="MyTheme" parent="@android:style/Theme.Holo.Light">
        <item name="android:actionBarStyle">@style/MyTheme.ActionBarStyle</item>
      </style>
    
      <style name="MyTheme.ActionBarStyle"parent="@android:style/Widget.Holo.Light.ActionBar">
        <item name="android:subtitleTextStyle">@style/MyTheme.ActionBar.TitleTextStyle</item>
      </style>
    
      <style name="MyTheme.ActionBar.TitleTextStyle" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
        <item name="android:textColor">@color/red</item>
      </style>