Place view below AppBarLayout without appbar_scrolling_view_behavior
<p>I am using a CoordinatorLayout that contains an AppBarLayout and a FrameLayout that will hold different fragments at runtime. I need the FrameLayout to always be below the AppBarLayout <em>without</em> using the appbar_scrolling_view_behavior attribute. For reasons (namely trying to get a RecyclerView and a floating footer button to work on the Fragments) I am applying this attribute on the RecylerView in the Fragment. Scrolling works fine except the FrameLayout thinks it should have the full height of the screen. This is usually fixed by the appbar_scrolling_view_behavior, but I <em>cannot</em> use that here. I tried layout_anchor and layout_anchorGravity to literally no effect.</p>

<p>Any ideas?</p>

<p>Layout:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;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"&gt;

    &lt;android.support.design.widget.AppBarLayout
        android:id="@+id/app_bar_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"&gt;

        &lt;android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            style="@style/AppTheme.Toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_scrollFlags="scroll|enterAlways"
            /&gt;

        &lt;android.support.design.widget.TabLayout
            android:id="@+id/tab_layout"
            style="@style/NavigationTab"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            /&gt;
    &lt;/android.support.design.widget.AppBarLayout&gt;

    &lt;!-- Fragments go here; they will set appbar_scrolling_view_behavior themselves --&gt;
    &lt;!-- layout_anchor and layout_anchorGravity don't work --&gt;
    &lt;FrameLayout
        android:id="@+id/fragment_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_anchor="@id/app_bar_layout"
        app:layout_anchorGravity="bottom|left|right"/&gt;

&lt;/android.support.design.widget.CoordinatorLayout&gt;
</code></pre>

<p>Layout of one of the fragments:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;FrameLayout 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:orientation="vertical"
             android:paddingEnd="15dp"
             android:paddingStart="15dp"&gt;

    &lt;!-- Bottom padding is so the last row isn't fully covered by the button --&gt;
    &lt;android.support.v7.widget.RecyclerView
        android:id="@+id/recycler_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:clipToPadding="false"
        android:paddingBottom="55dp"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"/&gt;

    &lt;Button
        android:id="@+id/add_photo_button"
        style="@style/ProductActionButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal|bottom"
        android:layout_marginBottom="15dp"
        android:drawableStart="@drawable/white_camera"
        android:text="@string/product_photo_add"/&gt;
&lt;/FrameLayout&gt;
</code></pre>