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
MenuItemsweren't made accessible so you don't have any direct options to access them. One way to alternate the selector for thoseMenuItemsis to useMenuItemswith action views set toImageViewsto hold the normal icon and change the selector for thoseImageViews. An example below:The code for the
ActionBarpart:The code for the
ActionModepart:This method will also allow you to avoid the need to handle/keeping the status of the
ActionBar/ActionModewhile theActivityis used.