change android's top bar background color

16,576

Make sure you reference this theme in your manifest

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

Then make sure your style is created correctly, previously you referenced a theme parent that wasn't in your code sample.

<style name="AppTheme" parent="@android:style/Theme.DeviceDefault">
    <item name="android:textColor">#008</item>
    <item name="android:windowTitleBackgroundStyle">@style/WindowTitleBackground</item>
</style>

<style name="WindowTitleBackground">     
    <item name="android:background">#0000FF</item>    
</style>
Share:
16,576
Arif YILMAZ
Author by

Arif YILMAZ

c#, mvc, web api, sql, t-sql, html5, jquery, css, angularjs

Updated on June 04, 2022

Comments

  • Arif YILMAZ
    Arif YILMAZ almost 2 years

    I am trying to change the background of the top bar which is created by eclipse automatically. I have read some tutorials and they suggested me to change "styles.xml" file. here is what I have done so far...

    <style name="AppTheme" parent="AppBaseTheme">
        <item name="android:textColor">#008</item>
        <item name="android:windowTitleBackgroundStyle">@style/WindowTitleBackground</item>
    </style>
    
    <style name="WindowTitleBackground">     
        <item name="android:background">#0000FF</item>
    </style>
    

    but this doesnt work. would you please take a look at it and tell me what is wrong with this code? because it doesnt do any effects.