Android: Title color does not change

I want to change my app title color and try it like this:

Part of the manifest file:

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

Part of the style block of the styles.xml file:

  <style name="Theme.MyTitleBar" parent="android:Theme"> <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> 

But only the color of the text and attributes change correctly. Any guest what I did wrong?

+3
android colors layout mono titlebar
source share
2 answers

EDIT: I added a part for ActionBar (sorry I'm only for Dialogs)

You can follow this, this will allow you to change, in addition, other attributes that are only a header:

Just call the 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 styles.xml . The first defines the theme, the second one of the styles applied to 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 am customizing the Holo Light theme, as you can see: android:style/Widget.Holo.Light.ActionBar .

+1
source share

Add this style.xml file to your project as per your requirement ...

  <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> 

0
source share

All Articles