Использование CoordinatorLayout во фрагментах с ActionBar в Activity

У меня проблема с использованием библиотеки поддержки Android Design. Я хотел бы использовать CoordinatorLayout внутри фрагмента для анимации FAB и ActionBar во время прокрутки, но у меня есть ActionBar в макете активности и мой CardGridStaggeredView и FAB во фрагменте.

макет деятельности:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/tools"
    xmlns:app1="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawer"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context=".MainActivity">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <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:fitsSystemWindows="true">

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

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

            <FrameLayout   <!--Here I display fragments-->
                android:id="@+id/fragment"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />
        </LinearLayout>

    <android.support.design.widget.NavigationView
        android:id="@+id/navigation_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        app:headerLayout="@layout/header"
        app:menu="@menu/drawer"
        app1:itemTextColor="@android:color/black"/>

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

макет фрагмента:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:tools="http://schemas.android.com/tools"
                xmlns:card="http://schemas.android.com/apk/res-auto"
                xmlns:app="http://schemas.android.com/apk/res-auto"
                style="@style/FragmentTheme"
                tools:context="androidhive.info.materialdesign.activity.HomeFragment">

    <FrameLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <android.support.v4.widget.SwipeRefreshLayout
            android:id="@+id/swipe_container"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <it.gmariotti.cardslib.library.extra.staggeredgrid.view.CardGridStaggeredView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:numColumns="2"
                android:stretchMode="columnWidth"
                android:verticalSpacing="2dp"
                android:horizontalSpacing="2dp"
                android:padding="1dp"
                android:gravity="center"
                card:list_card_layout_resourceID="@layout/carddemo_extras_base_staggered_card"
                style="@style/main_layout_foreground"
                android:id="@+id/cgvImages"
                app:layout_behavior="@string/appbar_scrolling_view_behavior"/>

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

        <android.support.design.widget.FloatingActionButton
            android:id="@+id/fab"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_add"
            android:layout_gravity="bottom|end"
            app:elevation="6dp"
            app:pressedTranslationZ="12dp"/>

    </FrameLayout>
</RelativeLayout>

Я пытался использовать CoordinatorLayout в Activity и Fragment, но это не сработало. Есть ли способ использовать CoordinatorLayout с ActionBar в Activity и другие представления во фрагменте?

Ответы на вопрос(1)

Ваш ответ на вопрос