Android: Title Bar Color don't change

别说谁变了你拦得住时间么 提交于 2019-12-01 09:17:20

EDIT: I added the part for the ActionBar (sorry I put only for Dialogs at first)

You can follow this, it will allow you to change moreover other attributes that just the title bar:

Just call your custom theme in the manifest file:

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

Then create these 2 styles in your styles.xml. The first one defines the theme, the second one, one of the styles to apply on the theme:

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

<style name="ActionBarStyle" parent="android:style/Widget.Holo.Light.ActionBar">     
    <item name="android:colorBackground">#FFFFFF</item>
    <item name="android:background">#FFFFFF</item>
    <item name="android:textColor">@android:color/black</item>
    <item name="android:textStyle">bold</item>
    <item name="android:textSize">16sp</item>
</style>

NOTE: In this example, I customize the theme Holo Light as you can see with this: android:style/Widget.Holo.Light.ActionBar.

Add This style.xml File in your project according to your requirment...

    <item name="android:actionBarStyle">@style/myActionBar</item>

</style>



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

<style name="myActionBar.titleTextStyle" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title.Inverse">
    <item name="android:textColor">@color/darkgrey</item>
</style>

 <style name="myActionBar" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
    <item name="android:background">#e6ebc3</item>
</style>

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!