Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Background change in styles.xml

I'm trying to change the background color to black in styles.xml. The background changes fine but the actionbar got dirty. Some part of the actiobar background stays the same while the other portion turns black. I don't want the actionbar to change color. Please help

<style name="Theme.ApplicationTheme" parent="@style/Theme.Sherlock">
    <item name="android:background">#000000</item> <!-- This line is changing the actionbar color -->
    <item name="actionBarStyle">@style/Widget.MyTheme.ActionBar</item>
    <item name="android:actionBarStyle">@style/Widget.MyTheme.ActionBar</item>
</style>

<style name="Widget.MyApplicationTheme.ActionBar" parent="Widget.Sherlock.ActionBar">
    <item name="android:background">#2d2d2d</item>
    <item name="background">#2d2d2d</item>
</style>
like image 503
Lalith Mohan Avatar asked Jun 03 '13 16:06

Lalith Mohan


1 Answers

Add following two additional items:

    <item name="android:windowBackground">#000000</item>
    <item name="android:colorBackground">#000000</item>

So that your style would look like:

<style name="Theme.ApplicationTheme" parent="@style/Theme.Sherlock">
    <item name="android:background">#000000</item> <!-- This line is changing the actionbar color -->
    <item name="android:windowBackground">#000000</item>
    <item name="android:colorBackground">#000000</item>
    <item name="actionBarStyle">@style/Widget.MyTheme.ActionBar</item>
    <item name="android:actionBarStyle">@style/Widget.MyTheme.ActionBar</item>
</style>
like image 124
ozbek Avatar answered Sep 28 '22 04:09

ozbek