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>
Since you are using the
Toolbar
, I also assume you are using theAppCompatActivity
and have replaced the built inActionBar
with your customToolbar
usingsetSupportActionBar(toolbar);
First of all ensure you are importing the correct namespace:
import androidx.appcompat.view.ActionMode;
// Or
import android.support.v7.view.ActionMode;
and NOT
import android.view.ActionMode;
then use
_actionMode = startSupportActionMode(this);
and NOT
_actionMode = startActionMode(this);