在 Android 中将工具栏添加到布局底部时滚动行为不起作用

Scrolling behaviour not working when toolbar is added at the bottom of the layout in Android

我必须按照设计在屏幕底部添加一个工具栏。如果我删除协调器内的相对布局,app:layout_scrollFlags="scroll|enterAlways" 工作正常。

但是没有这个相对布局,我无法将工具栏设置在屏幕底部!

如何通过更改以下布局来获得底部工具栏和顶部工具栏隐藏功能?

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <android.support.design.widget.AppBarLayout
            android:id="@+id/appBarLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">


            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:layout_gravity="bottom"
                android:background="?attr/colorPrimary"
                app:layout_scrollFlags="scroll|enterAlways"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />


            <android.support.design.widget.TabLayout
                android:id="@+id/tabLayout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/toolbar"
                android:background="@color/tab_color" />


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

        <include
            layout="@layout/inc_bottom_toolbar_with_menu"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true" />

        <android.support.v4.view.ViewPager
            android:id="@+id/viewPager"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_above="@+id/bottomToolBar"
            android:layout_below="@id/appBarLayout"
            app:layout_behavior="@string/appbar_scrolling_view_behavior" />


    </RelativeLayout>

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

PS : 由于我的 TL 坚持这样做,我已经删除了图像..

<RelativeLayout
  android:layout_width="match_parent"
  android:layout_height="match_parent">

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

<!-- bottom contents here --->

</RelativeLayout>