title: Android SupportLib - FrameLayout in CoordinatorLayout with AppBarLayout consuming entire screen-height
body: <p>I am currently having an issue with a <code>FrameLayout</code> in a <code>CoordinatorLayout</code> from Android design-support library whereas I followed the instructions from this <a href="http://blog.grafixartist.com/material-design-tabs-with-android-design-support-library/" rel="noreferrer">post</a> while creating the tabs.</p>
  
  <p>Basically most things work as expected, the container-fragments are inflated into the <code>FrameLayout</code> and theirs tab-fragments are correclty added to the <code>ViewPager</code> as tabs (need it this way because I have got numerous fragments which should reuse the layout).</p>
  
  <p>The problem I am struggling with is that the <code>FrameLayout</code> (and as a result also the tab-fragments) consumes the entire screen-height so it overlaps the <code>Toolbar</code> and the <code>TabLayout</code>. In order to visualize the problem I have created the following image:</p>
  
  <p><a href="https://i.stack.imgur.com/QGTzC.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/QGTzC.jpg" alt="Visualized issue"></a></p>
  
  <p><strong>Base-Layout with <code>CoordinatorLayout</code>, <code>Toolbar</code>, and <code>TabLayout</code>:</strong></p>
  
  <pre><code>&lt;android.support.design.widget.CoordinatorLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
      &lt;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"&gt;
  
          &lt;include layout="@layout/toolbar" /&gt;
  
          &lt;android.support.design.widget.TabLayout
              android:id="@+id/tabLayout"
              android:layout_width="match_parent"
              android:layout_height="wrap_content" /&gt;
  
      &lt;/android.support.design.widget.AppBarLayout&gt;
  
      &lt;FrameLayout
          android:id="@+id/container"
          android:layout_width="match_parent"
          android:layout_height="match_parent" /&gt;
  
  &lt;/android.support.design.widget.CoordinatorLayout&gt;
  </code></pre>
  
  <p><strong>Separate layout used by the fragments inflated into <code>container</code>:</strong></p>
  
  <pre><code>&lt;android.support.v4.view.ViewPager
      android:id="@+id/viewPager"
      android:layout_height="match_parent"
      android:layout_width="match_parent"
      app:layout_behavior="@string/appbar_scrolling_view_behavior" /&gt;
  </code></pre>
  
  <p>All fragments are inflated by my <code>BaseFragment</code>-class (on another post on SO calling <code>inflater.inflate(getLayoutRes(), null);</code> was the issue causing the same problem)</p>
  
  <pre><code>@Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      return inflater.inflate(getLayoutRes(), container, false);
  }
  </code></pre>
  
  <p>If I replace the <code>CoordinatorLayout</code> with a normal <code>LinearLayout</code> the <code>FrameLayout</code> starts below the <code>AppBarLayout</code> as expected but as per the <a href="https://developer.android.com/reference/android/support/design/widget/AppBarLayout.html" rel="noreferrer">documentation</a> the <code>AppBarLayout</code> for most of it´s features requires to be a direct child of the <code>CoordinatorLayout</code>.</p>
  
  <p>I could just add a <code>marginTop</code> to the <code>FrameLayout</code> but I would like to know if there is any appropriate solution for this. Thanks in advance for any hints!</p>