Change the action bar menu selected text color for appcompat

android, android-actionbar, android-actionbar-compat, android-styles

Solution

in my themes.xml, this did the trick

<style name="AppTheme.AppCompat.Light" parent="@style/Theme.AppCompat.Light"> 
        <item name="android:itemTextAppearance">@style/MenuTextAppearance</item>    
</style>

<style name="MenuTextAppearance">
        <item name="android:textColor">@android:color/black</item>
</style>

Additionally, I found you could use a spannable string to customize the text color of the menuItems programmatically. This caused the app to crash when using appcompay-v7 however others have had success with Sherlock, Holo, etc. Example:

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    inflater.inflate(R.menu.your_menu, menu);

    int positionOfMenuItem = 0; // or whatever...
    MenuItem item = menu.getItem(positionOfMenuItem);
    SpannableString s = new SpannableString("My red MenuItem");
    s.setSpan(new ForegroundColorSpan(Color.RED), 0, s.length(), 0);
    item.setTitle(s);
} 

https://stackoverflow.com/a/19008593/2820963

This would be great if you want different menu items to have different colors.

Problem

I have been having a lot of trouble trying to set the action bar text color using android-support-v7-appcompat. I was able to change the selector color from the default color to a light grey however now when I select something the text color changes as well. I want the text color to stay black when the user makes a selection. Any ideas? Thanks!

Original source