In my app I'm using the Toolbar as explained in the official documentation (v7 appcompat support library, Theme.Appcompat.Light.NoActionBar, android.support.v7.widget.Toolbar, setSupportActionBar(myToolbar))
:
http://developer.android.com/training/appbar/index.html
I have an ExpandableListView
and I'd like to implement the contextual action mode when I long-click on an item. To achieve this I use:
setMultiChoiceModeListener(new MultiChoiceModeListener())
.
This way, however, the action mode bar is displayed at the top of the screen, pushing down the Toolbar (I think it's because the system uses the ordinary action mode, and not the support action mode). I want it to be displayed on the Toolbar.
I tried this solution:
windowActionBarOverlay = true
but it doesn't work.
Android ActionBar is a menu bar that runs across the top of the activity screen in android. Android ActionBar can contain menu items which become visible when the user clicks the “menu” button.
The Toolbar is basically the advanced successor of the ActionBar. It is much more flexible and customizable in terms of appearance and functionality. Unlike ActionBar, its position is not hardcoded i.e., not at the top of an activity.
What is the difference between the toolbar and the action bar? The most obvious difference between the two is the updated visual design of the toolbar. The toolbar no longer includes an icon on the left side and decreases some of the spacing between the action items on the right side.
I had this problem as well.
The solution you tried was a bit off.
Instead of <item name="windowActionBarOverlay">true</item>
try setting <item name="windowActionModeOverlay">true</item>
in your App's theme. This will overlay the action mode bar over the toolbar as desired.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With