title: FAB inside FrameLayout to be on top of fragments
body: <p>In my layout I have a <code>FrameLayout</code> in which I intend to display different layouts depending on user input. I want to display a <code>FloatingActionButton</code> in all those layouts.</p>
  
  <p>In order to not repeat the <code>FloatingActionButton</code> in all of them, I want to have it attached to the <code>FrameLayout</code>. The problem is that the button is not displayed correctly on top of the <code>fragment</code> layout. For example, the initial <code>fragment</code> displayed, has a <code>GridView</code> and the button is behind it.</p>
  
  <p><code>activity_main.xml</code>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"
      tools:context="xeniasis.mymarket.MainActivity"&gt;
  
      &lt;include
          android:id="@+id/toolbar"
          layout="@layout/toolbar" /&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:baselineAligned="false"
          android:orientation="horizontal"
          android:weightSum="4"&gt;
  
          &lt;LinearLayout
              android:id="@+id/categories_layout"
              android:layout_width="0dp"
              android:layout_height="match_parent"
              android:layout_weight="1"
              android:paddingRight="20dp"&gt;
  
              &lt;ExpandableListView
                  android:id="@+id/categories_listView"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent" /&gt;
          &lt;/LinearLayout&gt;
  
          &lt;FrameLayout
              android:id="@+id/mainPane"
              android:layout_width="0dp"
              android:layout_height="match_parent"
              android:layout_weight="3"&gt;
  
              &lt;android.support.design.widget.FloatingActionButton
                  android:id="@+id/settings"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="bottom|start"
                  android:layout_margin="8dp"
                  android:clickable="true"
                  android:elevation="5dp"
                  android:src="@android:drawable/ic_menu_search" /&gt;
          &lt;/FrameLayout&gt;
      &lt;/LinearLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>and the <code>fragment</code> layout displayed programmatically:
      </p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"
      tools:context="xeniasis.mymarket.MainActivity"&gt;
  
          &lt;android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:id="@+id/swipeRefreshContainer"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:paddingBottom="@dimen/activity_vertical_margin"
              android:paddingLeft="8dp"
              android:paddingRight="8dp"
              android:paddingTop="@dimen/activity_vertical_margin"&gt;
  
              &lt;GridView
                  android:id="@+id/productsGridview"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_alignParentBottom="true"
                  android:layout_alignParentLeft="true"
                  android:layout_alignParentRight="true"
                  android:layout_alignParentTop="true"
                  android:numColumns="3"&gt;&lt;/GridView&gt;
  
          &lt;/android.support.v4.widget.SwipeRefreshLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>The result:
  <a href="https://i.stack.imgur.com/SSJpQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SSJpQ.png" alt="enter image description here"></a></p>