ActionMode with Toolbar offsetting content
Asked Answered
V

1

27

Ohoy. As Im upgrading my app to L, I replaced ActionBars with Toolbars and whenever I start an ActionMode now it pushes down all the content. (I suppose this is because the ActionBar is once again shown in order to display the ActionMode.) Is it possible to display the ActionMode as an overlay, or have it reside within the Toolbar?

Also no styling options seem to apply to it, which makes me wonder whether theres a new way to style it. Any ideas?

Im using AppCompat V7 21 and so far Ive tried windowActionModeOverlay=true and toolbar.startActionMode(..)

List with ActionMode running

Vociferation answered 19/10, 2014 at 13:19 Comment(8)
Hi. Were you able to set style for action mode? If so, how?Propjet
@vandzi Hi! Setting them in the base theme of my application without any android: prefix worked out.Vociferation
Hi zoltish, How did you achieve Any Equipment Spinner below search view and over flow icon.Upswing
@Upswing Its just a linearlayout with two spinners, colored same as the actionbar (toolbar in this case).Vociferation
@Vociferation how did you put shadow below toolbar?Jodeejodhpur
@JCodex Its a View with a gradient. On L its just the built in shadow from elevation.Vociferation
@Vociferation when i out view(4-5dp) it does not stick on top of content, but it pushes content below toolbar. So it does not look like shadow on me. Can you share, maybe on other topic?Jodeejodhpur
@JCodex Basically youll want to use a FrameLayout and have a top margin on the View that is equal to the Toolbars height, you can also play around with negative margins (marginBottom -6 dp if the Views height is 6 dp).Vociferation
K
52

Use <item name="windowActionModeOverlay">true</item> in your app theme (without android:).

Kaoliang answered 19/10, 2014 at 21:59 Comment(2)
On Android 4.4.4, I can see the Toolbar under the ActionMode. It's a dozen pixels taller. Is there any way to resize the ActionMode?Baseler
This seems to have changed back with the release of M. You should now have both with and without the android: prefix.Vociferation

© 2022 - 2024 — McMap. All rights reserved.