1

I was working hard to achieve this but I had no luck. What I tried to do is to change the background color from the style that I attached in my main style tag. This is my code:

<resources>

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

<style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
    <item name="android:background">#2E495E</item>
</style>

Still nothing changed. I get this in my application:

https://i.stack.imgur.com/s0i51.png

Mansour Fahad
  • 721
  • 2
  • 9
  • 23

2 Answers2

4

I had the same issue and it's probably the same problem you were having. Notice the docs say the following:

each style property that you declare must be declared twice..

So my issue was I declared it for 2.1 and up, but not for 3.0 and greater so my Galaxy S4 of course could not see any changes to the colours I was making.

<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light">
    <item name="android:actionBarStyle">@style/MyActionBar</item>

    <!--Support Library compatibility-->
    <item name="actionBarStyle">@style/MyActionBar</item>
</style>

<!-- ActionBar styles -->
<style name="MyActionBar"
    parent="@style/Widget.AppCompat.Light.ActionBar">

    <item name="android:background">@color/green</item>

    <!--Support Library compatibility-->
    <item name="background">@color/green</item>
</style>

<style name="NoActionBar" parent="Theme.AppCompat.Light">
    <item name="android:windowNoTitle">true</item>
</style>

Daniel Wilson
  • 18,838
  • 12
  • 85
  • 135
2

Is this the only style.xml you have? Else check if you are modifying for the right API

Archie.bpgc
  • 23,812
  • 38
  • 150
  • 226
  • 1
    Is this the only `style.xml` you have? Else check if you are modifying for the right **API**. – Archie.bpgc Sep 16 '13 at 12:59
  • Thank you man. Now it works. But do I supposed to put the same code in all style xml files that I have or is it enough if I put it in the xml file that has the lowest API I am targeting? – Mansour Fahad Sep 16 '13 at 13:24
  • Sorry I am not sure about that. I use a single file placed in single values folder. – Archie.bpgc Sep 16 '13 at 13:26
  • It is okay. Your answer was helpful. If you could write it as an independent answer, I will approve it as the best answer. – Mansour Fahad Sep 16 '13 at 13:31