How to align Floating Action Button to center

Setting layout_centerHorizontal and layout_centerInParent won't work in a CoordinatorLayout. They are only allowed in a RelativeLayout. You should do it like this:

app:layout_anchorGravity="center|bottom"

Your CoordinatorLayout is a FrameLayout , So try this way, I hope it will helps you .

 app:layout_anchorGravity="bottom|center"

Above solutions did not work for me somehow. I changed the android:layout_gravity to

android:layout_gravity="bottom|center"

Hope it helps :-)