Android 工具栏没有完全隐藏(> Lollipop)

Android toolbar not hiding entirely (> Lollipop)

在我的应用程序中,我使用 AppBarLayoutToolbar 作为我的支持操作栏。当用户滚动内容时,我希望它为 hide/show。在 KitKat 上一切正常,但在 Lollipop 和 Marshmallow 上工具栏没有滚动到它的全高。 Screen with toolbar fully scrolled

我的布局:

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context="(...)">

    <include
        android:id="@+id/app__content"
        layout="@layout/app_bar__main"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <fragment android:id="@+id/navigation_drawer"
        android:layout_width="@dimen/navigation_drawer_width"
        android:layout_height="match_parent"
        android:layout_gravity="left"
        android:fitsSystemWindows="true"
        android:name="(...)"
        tools:layout="@layout/fragment__navigation_drawer" />

</android.support.v4.widget.DrawerLayout>

app_bar__main.xml:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context="(...)">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/app__appbarlayout__action_bar_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay">

        <android.support.v7.widget.Toolbar
            android:id="@+id/app__toolbar"
            android:layout_width="match_parent"
            android:layout_height="@dimen/action_bar__height"
            android:background="@drawable/toolbar__background"
            android:elevation="4dp"
            app:layout_scrollFlags="scroll|enterAlways"
            app:popupTheme="@style/AppTheme.PopupOverlay"
            tools:ignore="UnusedAttribute" />

    </android.support.design.widget.AppBarLayout>

    <include layout="@layout/app_content__main" />

    <include android:id="@+id/app__layout__bottom_bar"
        layout="@layout/layout__bottom_bar" />

</android.support.design.widget.CoordinatorLayout>

app_content__main.xml 只是我要向其中添加片段的 FrameLayout。我使用 support:appcompat-v7:23.3.0support:design:23.2.0(由于工具栏的另一个错误,无法使用 23.3.0)。它在 23.0.0 上工作,但是有什么方法可以在不移动到这个以前的版本的情况下工作吗?

您必须从 CoordinatorLayout 中删除 android:fitsSystemWindows="true"。