The default action mode (3.0 and up) comes with a green theme and a 'Done' button on the left side. How can I customize these?
Thanks
The default action mode (3.0 and up) comes with a green theme and a 'Done' button on the left side. How can I customize these?
Thanks
Updated answer for both pre- and post-Lollipop devices. You must remove the android: prefix to get it to work on Lollipop+ devices, like so:
styles.xml:
v21/styles.xml:
I'd also recommend having your style with
parent="@style/Widget.AppCompat.ActionMode"
set, so you inherit the attributes you don't care about overriding.Here's an AppCompat (i.e. using startSupportActionMode) solution for temporarily customizing (customising) the CAB done button's image. Temporarily since it's desirable to change it back to use it's typical image so that when Text Selection kicks in it looks appropriate.
https://gist.github.com/coreform/36ed98f98668f2e90c6a
You can't really customize it this way because the attribute actionModeStyle is introduced at API level 14. For API levels 11 to 13 you are out of luck.
For API level 14, you can change the style by setting the android:actionModeStyle in your theme.
This is the style used for any ActionMode, I pulled it from the SDK. You'll need to create your own style to customize it. It's really easy to do. If you've never done anything like this before, you should read through this post on customizing the ActionBar. It explains everything you'll need to know.
Worked on my project
Custom ActionMode style
Custom Title ActionMode
Here is my approach with Java code: