android-floating-action-button
android-floating-action-button copied to clipboard
Center in layout
How to center menu in relative layout.
My code:
<com.getbase.floatingactionbutton.FloatingActionsMenu
android:id="@+id/multiple_actions_down"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="30dp"
fab:fab_labelStyle="@style/menu_labels_style"
fab:fab_addButtonColorNormal="#4cbdb0"
fab:fab_addButtonColorPressed="#4cbdb0"
fab:fab_addButtonSize="normal"
fab:fab_expandDirection="up">
<com.getbase.floatingactionbutton.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:foregroundGravity="center"
fab:fab_colorNormal="#176E64"
fab:fab_colorPressed="#4cbdb0"
fab:fab_size="mini"
fab:fab_title="Novo Pedido" />
</com.getbase.floatingactionbutton.FloatingActionsMenu>
thanks.
This library hasn't been updated in 5 years. Consider using ExpandableFab to achieve your desired functionality.
It has all the same functionality, plus more. Specifically to answer your question, you can center the ExpandableFab in a RelativeLayout simply by adding android:layout_gravity="bottom|center_horizontal"
to it.
The library comes with an example app that runs easily on your Android device to help you get started quickly. One of the example Fragments does exactly what you're asking for, see this layout file.
Let me know if you end up using the ExpandableFab and have any questions.