Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Action mode bar pushing down the Toolbar

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.

like image 455
iClaude Avatar asked Dec 04 '15 19:12

iClaude


People also ask

What is action toolbar?

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.

What is the difference between action bar and toolbar?

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 toolbar and action bar in android?

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.


1 Answers

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.

like image 141
Chad Mx Avatar answered Oct 14 '22 06:10

Chad Mx