Android协调器布局问题

Android协调器布局问题,android,android-coordinatorlayout,Android,Android Coordinatorlayout,我正在使用带有自定义折叠视图和表格布局的协调器布局。 这是xml <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:fresco="http://schemas.android.com/apk/res-auto"

我正在使用带有自定义折叠视图和表格布局的协调器布局。 这是xml

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:fresco="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">

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

    <android.support.design.widget.CollapsingToolbarLayout
        android:id="@+id/collapsing_toolbar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        app:contentScrim="?attr/colorPrimary"
        app:layout_scrollFlags="scroll|exitUntilCollapsed">

        <RelativeLayout
            android:id="@+id/cardParentLayout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_collapseMode="parallax">

            <com.facebook.drawee.view.SimpleDraweeView
                android:id="@+id/profilePicOverlay"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                fresco:actualImageScaleType="centerCrop"
                fresco:overlayImage="@drawable/profile_overlay" />

            <RelativeLayout
                android:id="@+id/childParentToAnimate"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:visibility="invisible">

                <include
                    android:id="@+id/cardLayout"
                    layout="@layout/layout_profile_card"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_centerInParent="true" />

                <com.facebook.drawee.view.SimpleDraweeView
                    android:id="@+id/profilePicCard"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerHorizontal="true"
                    fresco:actualImageScaleType="centerCrop"
                    fresco:backgroundImage="@drawable/profile_placeholder"
                    fresco:roundAsCircle="true"
                    fresco:roundingBorderColor="@color/white"
                    fresco:roundingBorderWidth="2dp" />

            </RelativeLayout>

        </RelativeLayout>

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="51dp"
            app:layout_collapseMode="pin"
            app:popupTheme="@style/AppTheme" />

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

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

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="fill_vertical"
    android:fillViewport="true"
    android:orientation="vertical"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

    <android.support.design.widget.TabLayout
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:layout_gravity="bottom"
        android:background="@color/blue_primary"
        app:tabGravity="fill"
        app:tabIndicatorColor="@android:color/white"
        app:tabMode="fixed" />

    <android.support.v4.view.ViewPager
        android:id="@+id/viewpager"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</LinearLayout>

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

如果在xml中向工具栏添加背景属性,则即使未折叠工具栏,工具栏也会显示以隐藏工具栏。在activityoncAreate()方法中实际执行。链接指向另一个stackoverflow问题。app:layout_scrollFlags=“scroll | enterAlways”将此行添加到工具栏并删除pinnig