My use case is this: the default action bar displays a blueish background and I want the buttons to turn green on press; on the other hand, the contextual action bar is green and I want the button to turn blue on press. (sort of inverse colours)
- Default action bar: blue background, green overlay (pressed state)
- Contextual action mode: green background, blue overlay (pressed state)
I have already the selectors, and I can set android:actionBarItemBackground in my theme to set the drawable for both modes. I can also style the close button setting a style in android:actionModeCloseButtonStyle and it works fine.
How can I style the other buttons then?
Thanks all, Gil
As I said in my comment, the views of the
MenuItems
weren't made accessible so you don't have any direct options to access them. One way to alternate the selector for thoseMenuItems
is to useMenuItems
with action views set toImageViews
to hold the normal icon and change the selector for thoseImageViews
. An example below:The code for the
ActionBar
part:The code for the
ActionMode
part:This method will also allow you to avoid the need to handle/keeping the status of the
ActionBar
/ActionMode
while theActivity
is used.