You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This view is for replacement of standard Floating Action Button from Google Support Library. It is easy to use, customizable and you can also add text to button
Setup
Gradle:
Add following line of code to your module(app) level gradle file
<com.robertlevonyan.examples.customfloatingactionbutton.view.FloatingActionLayout
android:id="@+id/customFABL"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_gravity="center_horizontal">
<!--Add any layout here-->
</com.robertlevonyan.examples.customfloatingactionbutton.view.FloatingActionLayout>
Circle layout
Rounded square layout
Square layout
<com.robertlevonyan.examples.customfloatingactionbutton.view.FloatingLayout
android:id="@+id/floating_layout"android:layout_width="match_parent"android:layout_height="match_parent">
<!-- Add here only com.robertlevonyan.examples.customfloatingactionbutton.view.FloatingActionButton or android.support.design.widget.FloatingActionButton, other views will be neglected by the layout--><!--Top view will be selected as a toggle for menu-->
<com.robertlevonyan.examples.customfloatingactionbutton.view.FloatingActionButton
... />
<com.robertlevonyan.examples.customfloatingactionbutton.view.FloatingActionButton
... />
<com.robertlevonyan.examples.customfloatingactionbutton.view.FloatingActionButton
... />
<com.robertlevonyan.examples.customfloatingactionbutton.view.FloatingActionButton
... />
<android.support.design.widget.FloatingActionButton
... />
</com.robertlevonyan.examples.customfloatingactionbutton.view.FloatingLayout>
Up
Down
Right
Left
Attributes
Custom Atributes
Description
app:fabType
Visual style of Floating Action Button (values: circle (default), square, roundedSquare)
app:fabSizes
Sizes of Floating Action Button (values: normal (default), mini)
app:fabText
Text label of Floating Action Button
app:fabTextAllCaps
Set text label all capitals
app:fabTextColor
Set custom color for text label
app:fabElevation
Change the elevation of view
app:fabColor
Custom color for Floating Action Button (default value is accent color)
app:fabIcon
Custom icon for Floating Action Button
app:fabIconColor
Custom color for icon
app:fabRippleColor
Custom ripple color for button
app:fabIconPosition
Icon position for icon (values: start (default), top, end, bottom)
Gravity of menu and items (values: start (default), end, bottom, top, center_horizontal, center_vertical, center)
app:fabAnimateMenu
Flag to animate menu toggle
Customizing from Java
floatingActionButton.setFabType(); /* Set button type | FloatingActionButton.FAB_TYPE_CIRCLE, FloatingActionButton.FAB_TYPE_SQUARE, FloatingActionButton.FAB_TYPE_ROUNDED_SQUARE */floatingActionButton.setFabSize(); /* Set button size | CustomFloatingActionButton.FAB_SIZE_NORMAL, CustomFloatingActionButton.FAB_SIZE_MINI */floatingActionButton.setFabText(); // Set text labelfloatingActionButton.setFabTextAllCaps(); // Set label all capitalsfloatingActionButton.setFabTextColor(); // Change color of labelfloatingActionButton.setFabElevation(); // Change elevationfloatingActionButton.setFabColor(); // Change background colorfloatingActionButton.setFabIcon(); // Change iconfloatingActionButton.setFabIconColor(); // Change icon colorfloatingActionButton.setFabIconPosition(); /* Change icon position | CustomFloatingActionButton.FAB_ICON_START, CustomFloatingActionButton.FAB_ICON_TOP, CustomFloatingActionButton.FAB_ICON_END, CustomFloatingActionButton.FAB_ICON_BOTTOM */
floatingActionLayout.setFabType(); /* Set button type | FloatingActionLayout.FAB_TYPE_CIRCLE, FloatingActionLayout.FAB_TYPE_SQUARE, FloatingActionLayout.FAB_TYPE_ROUNDED_SQUARE */floatingActionLayout.setFabElevation(); // Change elevationfloatingActionLayout.setFabColor(); // Change background color
floatingLayout.setFabAnimationStyle(); /* Set the pop animation of items | FloatingLayout.ANIMATION_POP_UP, FloatingLayout.ANIMATION_POP_DOWN, FloatingLayout.ANIMATION_POP_RIGHT, FloatingLayout.ANIMATION_POP_LEFT */floatingLayout.setFabMenuGravity(); /* Set gravity of menu items | FloatingLayout.MENU_GRAVITY_START, FloatingLayout.MENU_GRAVITY_END, FloatingLayout.MENU_GRAVITY_BOTTOM, FloatingLayout.MENU_GRAVITY_TOP, FloatingLayout.MENU_GRAVITY_CENTER_HORIZONTAL, FloatingLayout.MENU_GRAVITY_CENTER_VERTICAL, FloatingLayout.MENU_GRAVITY_CENTER */
Setting Listeners
floatingLayout.setOnMenuExpandedListener(newFloatingLayout.OnMenuExpandedListener() {
@OverridepublicvoidonMenuExpanded() {
// Do stuff when expanded...
}
@OverridepublicvoidonMenuCollapsed() {
// Do stuff when collapsed...
}
});
Versions
2.1.0
Some bug fixing
2.0.0 - 2.0.4
Second version of library.
Totaly rewritten.
Added Floating action layout and Floating layout
This view is for replacement of standard Floating Action Button from Google Support Library. It is easy to use, customizable and you can also add text to button