Overlay or hide Toolbar on copy/cut selection

android, android-layout

Solution

in your theme you need to add this to it

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

so it would look something like this

<style name="AppBaseTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="colorPrimary">@color/color_primary</item>
    <item name="colorPrimaryDark">@color/color_primary_dark</item>
    <item name="colorAccent">@color/color_primary</item>
    <item name="windowActionModeOverlay">true</item>
</style>

Problem

I've created an activity with the new Appcompat v21 Toolbar. Everything works fine except when I highlight some text out of a TextView. The copy/cut Actionbar shows up, but instead of overlaying my existing toolbar or hiding it it just pushes the toolbar down so I get something like this: Now my question is, how can I make the copy/cut actionbar overlay my toolbar? Or should I just hide it if text is selected? If so, how do I listen for textselection? Best regards

Original source