Search code examples
androidandroid-actionmode

How to make contextual actionmode bar overlay my layout instead of "pushing" it down


I have implemented my own viewgroup for my application. Using actionbar is not an option for various reasons so in my viewgroup I have my own "actionbars" one on top and one in the bottom. Image 1 illustrates my current layout.

Image 1

As you can see there are two edittexts in the layout and everything looks ok.

However when the user selects some text in any of the edittexts the contextual actionmode bar is shown. Image 2 illustrates this.

Image 2

When this happens actionmode bar "pushes" down my entire layout in order to get its space. In tablets and other large screen devices this is OK but in smaller devices and especially with the soft keyboard visible the remaining height is too small (in landscape orientation is unusable).

What I want to do is actionmode bar to overlay my layout instead of pushing it down as shown in Image 3.

Image 3

Is that possible?


Solution

  • Just add <item name="android:windowActionModeOverlay">true</item> to your style.