Contextual action bar does not overlay my toolbar

时光毁灭记忆、已成空白 提交于 2019-12-03 11:41:37

If you want the Contextual ActionBar overlap over Toolbar then use this

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

instead of

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

you can try this theme this may solve your problem.

 <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

        <item name="windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>

 </style>
<!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/color_primary</item>
        <item name="colorPrimaryDark">@color/color_primary_dark</item>
        <item name="colorAccent">@color/color_accent</item>

        <item name="alertDialogTheme">@style/AppCompatAlertDialogStyle</item>

        <!-- required for toolbar in prelolipop -->
        <item name="android:windowNoTitle">true</item>
        **<item name="windowActionModeOverlay">true</item>**

    </style>

use <item name="windowActionModeOverlay>true</item> for Contextual action bar to overlay toolbar. And remove if you have used <item name="windowActionBar">false</item>. It worked for me.

This worked For me,

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

            <item name="windowNoTitle">true</item>
            <item name="windowActionBar">false</item>
            <item name="colorPrimary">@color/colorPrimary</item>
            <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
            <item name="colorAccent">@color/colorAccent</item>
            <item name="windowActionModeOverlay">true</item>

     </style>

Since my toolbar was at the bottom of the activity, solution was to make my own contextual action bar that will overlay it.

This project below gave me a head start.

https://github.com/afollestad/material-cab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!