Android: Changing the color of the action bar

advertisements

I had previously set the colour of my window background to white and now I am trying to change the colour of just the action bar to green. This is my xml code:

<style name = "CustomAppTheme2" parent = "android:Widget.Holo.Light">

    <item name="android:windowBackground">@color/white</item>
    <item name="android:background">@color/green</item>
    <item name="android:icon">@android:color/transparent</item>
</style>

The problem is that using android:background to change the colour of the action bar, it overflows and changes the colour of the whole screen to green. I want a clear-cut green action bar and a white window below it. Thanks in advance!


     <!-- Base application theme. -->
        <style name="AppTheme" parent="@style/CustomActionBarTheme">
            <!-- Customize your theme here. -->
        </style>
        <!-- the theme applied to the application or activity -->
        <style name="CustomActionBarTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">

            <!-- Support library compatibility -->

            <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.Solid.Inverse">
            <item name="android:background">@drawable/top_bar_blue</item>

            <!-- Support library compatibility -->
            <item name="background">@drawable/top_bar_blue</item>
            <item name="titleTextStyle">@style/myTheme.ActionBar.Text</item>
        </style>
    <!-- ActionBar Text -->
        <style name="myTheme.ActionBar.Text" parent="TextAppearance.AppCompat.Widget.ActionBar.Title">
            <item name="android:textColor">@android:color/white</item>
            <item name="android:textSize">20sp</item>
            <item name="android:textStyle">bold</item>
            <item name="android:fontFamily">sans-serif-bold</item>
        </style>
<!-- In Manifest -->
android:theme="@style/AppTheme"