Modify style of Android items in the ActionBar

23,966

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!

Share:
23,966
Paulo Barros
Author by

Paulo Barros

Updated on January 08, 2020

Comments

  • Paulo Barros
    Paulo Barros over 4 years

    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>
    
  • Paulo Barros
    Paulo Barros over 12 years
    Didn't work here. This android:titleTextStyle makes no effect in my code at all, I had already tried it before though.
  • Paulo Barros
    Paulo Barros over 12 years
    I guess this is only for the Title of the application, not the title of the itens.
  • Paulo Barros
    Paulo Barros over 12 years
    Thank you for the link, really helpfull. I just updated my question.
  • Dory
    Dory about 11 years
    Hello, I tried this solution. It changes the menu items color in action bar. But may sub menu items are not changing. What should i do to change the color or sub menu items.
  • Tooroop
    Tooroop about 11 years
    Hi, you are probably talking about changing the overflow menu style. I am not really 100% sure about the solution but try checkign these links: groups.google.com/forum/?fromgroups=#!topic/actionbarsherloc‌​k/… stackoverflow.com/questions/14859794/…
  • dbm
    dbm over 10 years
    This is the sh*t that did it for me. It also works on the ActionBarCompat (the v7 support package for Android). Having a quick look in the resource files provided for the ActionBarCompat by the support package also confirms the actionMenuTextColor attribute.