title: Android Floating Action Button wrong position despite gravity is set
body: <p>I'm currently facing two different issues, both regarding fab gravity behavior.</p>
  
  <p>In my layout I have a section consisting in a <code>FrameLayout</code> with an <code>ImageView</code> and a <code>FloatingActionButton</code> as children views.</p>
  
  <pre><code>`&lt;RelativeLayout ...&gt;
  
      *Here's a toolbar*
  
      &lt;ScrollView ...&gt;
  
          &lt;LinearLayout ...&gt;
  
              &lt;FrameLayout
                  android:id="@+id/prof_img"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:padding="@dimen/activity_vertical_margin"&gt;
  
                  &lt;de.hdodenhof.circleimageview.CircleImageView
                      android:id="@+id/profile_image"
                      android:layout_width="@dimen/size_editing_pic"
                      android:layout_height="@dimen/size_editing_pic"
                      android:src="@drawable/ic_profilo_utente"/&gt;
  
                  &lt;android.support.design.widget.FloatingActionButton
                      android:id="@+id/floating_btn"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_gravity="bottom|end"
                      android:scaleType="center"
                      android:tint="@color/dark_gray"
                      app:layout_anchor="@id/profile_image"
                      app:layout_anchorGravity="bottom|end|right"
                      app:srcCompat="@drawable/ic_camera"
                      app:backgroundTint="@color/colorAccentEasy"
                      app:fabSize="mini"/&gt;
              &lt;/FrameLayout&gt;
  
              *Other sections*
  
          &lt;/LinearLayout&gt;
      &lt;/ScrollView&gt;
  &lt;/RelativeLayout&gt;`
  </code></pre>
  
  <hr>
  
  <ul>
  <li>Issue 1: Android version >= Lollipop</li>
  </ul>
  
  <p>The FAB is right where it should be but you can see that its shadow is clearly cut without the supposed fading.</p>
  
  <p><a href="https://i.stack.imgur.com/RrLB2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RrLB2.png" alt="Post-Lollipop behavior"></a></p>
  
  <hr>
  
  <ul>
  <li>Issue 2: Android version &lt; Lollipop</li>
  </ul>
  
  <p>The FAB is not where it's supposed to be.</p>
  
  <p><a href="https://i.stack.imgur.com/bm76h.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bm76h.png" alt="Pre-Lollipop behavior"></a></p>
  
  <hr>
  
  <p>I tried anything that came to my mind and that I found online and here on SO.
  I understand that it has to do with the different padding management that the core code does if the OS is pre or post Lollipop, and with the attribute <code>useCompatPadding</code> (which I tried in different combinations), but I can't figure out how to successfully resolve it.</p>
  
  <hr>
  
  <h2>UPDATE</h2>
  
  <p>Thanks to the suggestion I managed to solve Issue #1.</p>
  
  <p>As far as Issue #2 is concerned, though, I still can't solve it.
  In my new fabStyle-v21 a <code>layout_margins</code> of 5dp since it perfectly suited my needs.
  I then tried putting a 0dp margin in the default style, but still nothing, even trying negative margins.</p>