Modify style of Android items in the ActionBar

Paulo Barros picture Paulo Barros · Nov 30, 2011 · Viewed 23.9k times · Source

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>

Answer

Tooroop picture Tooroop · Jan 7, 2013

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!