As the title suggests, I have an activity that has a FrameLayout that houses my Fragments [I am NOT using a Tabs, just Transactions]. I also have a NavigationDrawer and Toolbar. All of these things work fine.
The issue is that I'm trying to add a CollapsingToolbarLayout to the Activity layout and have RecyclerView in the Fragment scroll and control the collapsing of the CollapsingToolbarLayout.
With the setup shown below, I'm able to use the NavigationDrawer, see the Toolbar and the expanded CollapsingToolbarLayout with NO image inside (odd issue there). I load the Fragment into the FrameLayout which contains a RecyclerView with 10 test views. This scrolls fine below the CollapsingToolbar but it does not collapse.
Activity Layout XML
<android.support.v4.widget.DrawerLayout
android:id="@+id/dl_drawer_layout"
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"
android:fitsSystemWindows="true">
<android.support.design.widget.CoordinatorLayout
android:id="@+id/cl_dashboard"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.AppBarLayout
android:id="@+id/abl_dashboard"
android:layout_width="match_parent"
android:layout_height="200dp"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/ctb_dashboard"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="@color/the_color"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:id="@+id/iv_dashboard_header"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@mipmap/the_image"
android:fitsSystemWindows="true"
app:layout_collapseMode="parallax"/>
<include
android:id="@+id/toolbar"
layout="@layout/overlay_toolbar"
app:layout_collapseMode="pin"/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/fl_dashboard_fragmentframe"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
</FrameLayout>
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.NavigationView
android:id="@+id/nv_navigation_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:headerLayout="@layout/overlay_drawer_header"
app:menu="@menu/menu_drawer"/>
</android.support.v4.widget.DrawerLayout>
Fragment Layout XML
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_fragment_dashboardhome"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
</android.support.v7.widget.RecyclerView>
I don't understand why this isn't working and I've run through a lot of documentation and examples with no luck. Any help or suggestion would be greatly appreciated.