title: Positioning views in Coordinator Layout
body: <p>I am trying to create a screen with coordinator layout that includes: </p>
  
  <ul>
  <li>Toolbar </li>
  <li>Fragment, which will be replaced for every page using navigation API </li>
  <li>Bottom App bar</li>
  </ul>
  
  <p>However, I am struggling with positioning views in a way so the app's bottom bar doesn't overlap what in the fragment. </p>
  
  <p>Any chance you could help me out with this, please? From what I can tell, the only way is to add a margin at the bottom but this may not be consistent across devices. </p>
  
  <p>To illustrate, this list has a total of 25 items but the last two are overlapped by the app's bottom bar. </p>
  
  <p><a href="https://i.stack.imgur.com/YgSLg.png" rel="noreferrer"><img src="https://i.stack.imgur.com/YgSLg.png" alt="enter image description here"></a></p>
  
  <p><strong>activity main</strong> </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;androidx.coordinatorlayout.widget.CoordinatorLayout
          xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:app="http://schemas.android.com/apk/res-auto"
          xmlns:tools="http://schemas.android.com/tools"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          tools:context=".MainActivity"&gt;
  
      &lt;com.google.android.material.appbar.AppBarLayout
              android:id="@+id/app_bar_layout"
              android:layout_height="wrap_content"
              android:layout_width="match_parent"
              android:theme="@style/AppTheme.AppBarOverlay"
              android:animateLayoutChanges="true"
              android:layout_above="@id/include"&gt;
  
          &lt;androidx.appcompat.widget.Toolbar
                  android:id="@+id/toolbar"
                  android:layout_width="match_parent"
                  android:layout_height="?attr/actionBarSize"
                  android:background="?attr/colorPrimary"
                  app:popupTheme="@style/AppTheme.PopupOverlay"/&gt;
  
          &lt;com.google.android.material.tabs.TabLayout
                  android:id="@+id/tabs"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"&gt;
  
              &lt;com.google.android.material.tabs.TabItem
                      android:text="Test 1"
                      android:layout_height="match_parent"
                      android:layout_width="match_parent"/&gt;
  
              &lt;com.google.android.material.tabs.TabItem
                      android:text="Test 2"
                      android:layout_height="match_parent"
                      android:layout_width="match_parent"/&gt;
          &lt;/com.google.android.material.tabs.TabLayout&gt;
  
      &lt;/com.google.android.material.appbar.AppBarLayout&gt;
  
      &lt;include
              layout="@layout/content_main"
              android:id="@+id/include"/&gt;
  
      &lt;com.google.android.material.bottomappbar.BottomAppBar
              android:id="@+id/bar"
              android:layout_gravity="bottom"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"/&gt;
  
      &lt;com.google.android.material.floatingactionbutton.FloatingActionButton
              android:id="@+id/fab"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              app:layout_anchorGravity="right|top"
              app:layout_anchor="@+id/bar"
              android:src="@drawable/ic_add_black_24dp"/&gt;
  
  &lt;/androidx.coordinatorlayout.widget.CoordinatorLayout&gt;
  </code></pre>
  
  <p><strong>content main xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;FrameLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  app:layout_behavior="@string/appbar_scrolling_view_behavior"
  tools:showIn="@layout/activity_main"
  tools:context=".MainActivity"&gt;
  
      &lt;fragment
              android:layout_width="411dp"
              android:layout_height="627dp"
              android:name="com.example.fitnessfatality.startScreen.StartFragment"
              android:id="@+id/fragment"
              /&gt;
  
  &lt;/FrameLayout&gt;
  </code></pre>