Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do Android's new Toolbar and the Contextual Action Bar work together? [duplicate]

I'm redesigning my current app roughly following Chris Bane's excellent intro here. One thing struck me, though:

If I set the new v7-appcompat Toolbar as actionbar replacement via setSupportActionBar() and derive my theme from Theme.AppCompat.Light.NoActionBar, then the contextual action bar (CAB) will still pop up and push my contents, including the Toolbar, down:

Now, I could try to make the CAB overlay my Toolbar, but I figured the UI (basically the metrics and placement) of the back button and text of the CAB don't match the Toolbar either (as seen in the image), so I wonder if there is rather a "CAB" mode in the Toolbar implementation so that the Toolbar could take over this role as well?

like image 659
Thomas Keller Avatar asked Oct 21 '14 07:10

Thomas Keller


1 Answers

You need to set the following in your theme:

<item name="windowActionModeOverlay">true</item>

This will make the action mode overlay for content view, and therefore your Toolbar.

like image 127
Chris Banes Avatar answered Nov 10 '22 02:11

Chris Banes