1

我的应用程序包含一个DrawerLayout,并在其中包含appcompat工具栏。 当抽屉“打开”碎片时,一切正常,但是当我从片段开始一个活动,然后显示动作模式菜单时,它们显示在工具栏顶部,但我希望它通过工具栏以相同的方式碎片工作。当ActionMode打开时,AppCompat工具栏保持可见

这种影响是存在于Android 5.0.1和4.4.2奇巧

没有办法解决发现SO为我工作。

当动作模式菜单可见时,我该如何解决它并只显示动作模式而不是

下图显示了错误的结果 ActionMode and Toolbar

这是预期的结果 enter image description here

被叫活动布局

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" > 
    <include layout="@layout/toolbar_app"/> 
    <FrameLayout 
     android:id="@+id/content_frame" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"/> 
</LinearLayout> 

工具栏布局

<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" 
            xmlns:app="http://schemas.android.com/apk/res-auto" 
            android:id="@+id/my_toolbar" 
            android:layout_height="wrap_content" 
            android:layout_width="match_parent" 
            android:minHeight="?attr/actionBarSize" 
            app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light" 
            android:background="?attr/colorPrimary"/> 

回答

1

添加<item name="windowActionModeOverlay">true</item>的风格会解决这个问题

+0

这是已经存在于主题定义,实际上它的片段工作,我的问题是有关的活动从片段 – dafi

+0

开始为什么ü接受的,如果它没没有工作? o.0 – Ewoks

+0

@dafi我面临着完全相同的问题。我在窗口中提到了windowAcitonModeOverlay。你能让我知道,你是如何解决这个问题的? – Minions

相关问题