Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change background color of ActionBar title?

No matter how I modify the styles, the background color of the box pointed to by the red arrow just won't change from the background.

img

How do I change that color? I'm targeting 4.0+ and don't care about 4.0- devices and OSes.

Here's a link to my styles.xml file. Sorry I had to censor a few things as this project is under an NDA.

I have tried many things including:

  • Changing android:background in windowTitleBackgroundStyle
  • Changing android:background in actionBarStyle
  • Changing android:background in actionBarWidgetStyle
  • Changing android:actionBarItemBackground

None of those work. That text view seems to always stick to the android:background value from my base theme and nothing was able to override it.

What am I missing or doing wrong?

like image 807
chakrit Avatar asked Jul 17 '13 11:07

chakrit


1 Answers

Well you need to change android:background with windowBackground

<style name="CCCBaseTheme" parent="@android:style/Theme.Holo">
    <item name="android:windowBackground">@color/nav_background</item>
    <item name="android:textColor">@color/text</item>

    <item name="android:actionBarStyle">@style/CCCWidgetActionBar</item>

</style>

hope this will help.

like image 165
M.Khouli Avatar answered Sep 22 '22 17:09

M.Khouli