Question

How can I modify the style of the items on the Action bar of an Android Application?

I tryed the following:

<item name="android:actionBarStyle">@style/ActionBar.Light</item>

<style name="ActionBar.Light" parent="@style/ActionBar">
        <item name="android:background">@color/black</item>
        <item name="android:actionMenuTextColor">#FF00FF</item>
</style>

The background of the Action bar I was able to modify, but not the text Colors of the items in the Action bar. How can I do it?

EDIT:

I tried pretty much all the android:action attributes I found, but I couldn't manage to change anything other than the background. Only the first <item name="android:background">#FF0000</item> of the following code makes changes on my code. No matter which values I put on the Test style, it doesn't change anything. Why is it happening?

<item name="android:actionBarStyle">@style/ActionBar.Light</item>

<style name="ActionBar.Light" parent="@style/ActionBar">
        <item name="android:background">#FF0000</item>
        <item name="android:actionMenuTextColor">@style/Test</item>
        <item name="android:actionButtonStyle">@style/Test</item>
        <item name="android:actionModeBackground">@style/Test</item>
        <item name="android:actionMenuTextAppearance">@style/Test</item>
    </style>

    <style name="Test">
        <item name="android:textColor">@color/white</item>
        <item name="android:background">#FF0000</item>
    </style>
Was it helpful?

Solution

If you want to change the color of the menu items in the action bar you have to set the actionMenuTextColor in your theme style.

<style name="PortfolioTheme" parent="android:style/Theme.Holo.Light">
   <item name="android:actionMenuTextColor">#24598a</item>
   <item name="actionMenuTextColor">#24598a</item>
</style>

You don't define the menu item colors in the actionMenuTextAppearance!

OTHER TIPS

You can change the color by:-

<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyTheme" parent="@android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">@style/MyTheme.ActionBarStyle</item>
</style>

<style name="MyTheme.ActionBarStyle" parent="android:style/Widget.Holo.ActionBar">
<item name="android:titleTextStyle">@style/MyTheme.ActionBar.TitleTextStyle</item>
</style>

<style name="MyTheme.ActionBar.TitleTextStyle" parent="android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">@color/red</item>
</style>
</resources>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top