Gaurav Singh
Gaurav Singh

Reputation: 3

White title background in ActionBar after changing the Actionbar Colour

I followed the steps mentioned in Styling the Action Bar | Android Developers to change the colour of the action bar.

But I am getting weird action bar. The actionbar colour is changed to green but the text in actionbar has different background (white), the buttons in actionbar has different background (white).

The code I used is as follows:

<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
    <item name="android:background">@color/core_white</item>
    <item name="android:actionBarStyle">@style/ActionBar</item>
    <item name="android:buttonStyle">@style/Button</item>
    <item name="android:editTextStyle">@style/EditText</item>
</style>

<style name="ActionBar" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
    <item name="android:background">@color/core_other</item>
    <item name="android:backgroundStacked">@color/core_other_light</item>
    <item name="android:backgroundSplit">@color/core_other</item>


</style>

Below are the screen shots of the theme I got:

Upvotes: 0

Views: 932

Answers (2)

rKrishna
rKrishna

Reputation: 1399

try this
  <resources>
        <style name="AppTheme" parent="@android:style/Theme.Holo.Light">
            <item name="android:actionBarStyle">@style/ActionBar</item>
        </style>

        <style name="ActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
            <item name="android:background">ANY_HEX_COLOR_CODE</item>
        </style>
    </resources>

Upvotes: 0

Dhaval Parmar
Dhaval Parmar

Reputation: 18978

<style name="AppTheme" parent="android:Theme.Material.Light.DarkActionBar">
        <item name="android:actionBarStyle">@style/ActionBar</item>
        <item name="android:buttonStyle">@style/Button</item>
        <item name="android:editTextStyle">@style/EditText</item>
        <item name="android:windowBackground">@android:color/black</item>
    </style>

    <style name="ActionBar" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">

        <item name="android:backgroundStacked">@color/core_other_light</item>
        <item name="android:backgroundSplit">@color/core_other</item>
        <item name="android:background">#00ff00</item>

    </style

>

Change background in app theme to windowBackground

More detail check :

https://developer.android.com/training/material/theme.html enter image description here

I have used Material Theme you can use holo or other

Upvotes: 2

Related Questions