I am trying to use the android.view.ActionMode
with the new android.support.v7.widget.Toolbar
, in addition to the traditional android.app.ActionBar
. I am able to display it with:
toolbar.startActionMode(callback);
The problem is that the ActionMode
is displayed over the ActionBar
, and not over the Toolbar
. Is there a way to change that?
I tryied to set the following in my theme, but it does not seem to change anything:
<item name="windowActionModeOverlay">true</item>
First of all ensure you are importing the correct namespace.
and NOT
then use
and NOT
Do not start it on your activity, but on your toolbar. In you activity:
and you have to use
in your theme as stated by Andre.
Try this in your theme:
find your AndroidManifest.xml ,next add below code in your application or Activity theme
so like:
I have tried all the methods above, but it still doesn`t work. And then, I tried the below method:
Here, I used action mode and startSupportActionMode method of support library. At the same time I have also tried to modify the theme of given activity. Surely, it doesn`t work. So, if you really have no better choice you may try this one.
Just recently, I have found that I used the Colorful frame to enable multiple theme of my app, this will change the theme in code. When I tried to modify the style in this framework, it works.
Hope it works.
This is the solution I made.
In my onCreateActionMode method of ActionMode.Callback, I add this:
It works for me.