2

I have a dark ActionBar with a light Contextual ActionBar for ActionModes. I've seen this question about changing the overflow icon in the ActionBar, and it works, but I need a way to change it only for the Contextual ActionBar. Is there a way to do this?

Community
  • 1
  • 1
Karakuri
  • 38,365
  • 12
  • 84
  • 104

1 Answers1

0

You can create a theme just for the overflow icon then use ContextThemeWrapper.setTheme in ActionMode.Callback.onCreateActionMode. For instance:

style

<style name="Widget.ActionButton.Overflow" parent="@android:style/Widget.Holo.ActionButton.Overflow">
    <item name="android:src">@drawable/your_overflow_icon</item>
</style>

<style name="CAB.Overflow" parent="@android:style/Theme.Holo.Light">
    <item name="android:actionOverflowButtonStyle">@style/Widget.ActionButton.Overflow</item>
</style>

ActionMode

@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
    setTheme(R.style.CAB_Overflow);
    // Inflate your menu items
    return true;
}

Normal and CAB

Before After

adneal
  • 30,484
  • 10
  • 122
  • 151