Search code examples
androidandroid-layoutanchorfloating-action-button

Anchroing Fab Button


How do i anchor fab at the red marked position in image attached below. Any help is appreciated. Also please visit this git hub link to suggest change. Github link

Image for reference


Solution

  • As per my above comment

    Just remove android:layout_margin="@dimen/fab_margin" from FloatingActionButton

    like this

    <android.support.design.widget.FloatingActionButton
                    android:id="@+id/share_fab"
                    android:layout_width="@dimen/fab_width"
                    android:layout_height="@dimen/fab_height"
                    android:clickable="true"
                    app:rippleColor="@color/secondaryDarkColor"
                    android:contentDescription="@string/action_share"
                    android:src="@drawable/ic_share"
                    app:borderWidth="0dp"
                    app:elevation="@dimen/fab_elevation"
                    app:layout_anchor="@id/meta_bar"
                    app:layout_anchorGravity="right|bottom" />