Android Anchor FloatingActionButton To Appbar

May 11, 2018

Use app:layout_anchor and app:layout_anchorGravity (not android:layout_gravity)

<android.support.design.widget.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_margin="@dimen/fab_margin"
    app:layout_anchor="@id/app_bar"
    app:layout_anchorGravity="bottom|end"
    app:srcCompat="@android:drawable/ic_dialog_email" />
This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.