class ExpandableFab : FloatingActionButton
The design and behavior of a Floating Action Button which can animate and expand to show optional FabOptions when clicked. It's the focal point for the ExpandableFab widget's functionality, from an end-user's perspective.
Developer Notes:
Implementation Notes:
Since
1.0.0
<init> |
Used to create an ExpandableFab programmatically (do not use the other constructor ExpandableFab(context, attributeSet) - it is for use by the Android framework when inflating an ExpandableFab via XML). This constructor keeps all optional properties of an ExpandableFab and its optional label at their default values, though you can always change these values after instantiation by using the appropriate setter methods (with the exception of orientation, which cannot be changed after instantiation). ExpandableFab(context: Context, orientation: Orientation? = Orientation.PORTRAIT)
Called by the system when creating an ExpandableFab via XML (don't call this directly). To create an ExpandableFab programmatically, use the ExpandableFab(context, orientation) constructor. ExpandableFab(context: Context, attributeSet: AttributeSet) |
closingAnimationDurationMs |
The duration (in milliseconds as a positive long) of the ExpandableFab's closing animations. Default value is 500L. var closingAnimationDurationMs: Long |
closingAnticipateTension |
The tension (as a positive float) applied on the ExpandableFab's icon to mimic an AnticipateInterpolator when it's playing its closing animations. An AnticipateInterpolator allows us to have a closing animation where the ExpandableFab's icon will begin rotating slightly backwards, before smoothly rotating forward to its default 0 degree rotation. Every multiple of 10f will be a full 360 degree rotation backwards. Default value is 2f. var closingAnticipateTension: Float |
efabColor |
The color of the ExpandableFab. Default value is your app's colorAccent. var efabColor: Int |
efabEnabled |
The enabled state of this ExpandableFab and its label. Disabled ExpandableFabs and labels will be visually distinct and unclickable. Default value is true (enabled). var efabEnabled: Boolean |
efabIcon |
The drawable to show as the ExpandableFab's icon. Default value is a white plus sign vector drawable. var efabIcon: Drawable? |
efabSize |
The size of this ExpandableFab (NOT its FabOptions. For that, see property fabOptionSize). Must be FabSize.MINI, FabSize.NORMAL, FabSize.AUTO or FabSize.CUSTOM. FabSize.CUSTOM should be used when you're setting the size of the ExpandableFab's layout_width and layout_height to a custom value manually (when using CUSTOM, make sure to also set app:fabCustomSize equal to your custom layout_width/layout_height size and app:maxImageSize equal to your icon size in order to ensure your icon is centered properly). Default value is FabSize.NORMAL. var efabSize: FabSize |
fabOptionPosition |
How each FabOption in this orientation will be positioned relative to the previous FabOption. Default value is FabOptionPosition.ABOVE. var fabOptionPosition: FabOptionPosition |
fabOptionSize |
The size of each FabOption in this orientation (NOT the size of the ExpandableFab. For that, see property efabSize). Must be FabSize.MINI, FabSize.NORMAL, FabSize.AUTO or FabSize.CUSTOM. FabSize.CUSTOM should be used when you're setting the size of the FabOptions' layout_width and layout_height to a custom value manually (when using CUSTOM, make sure to also set app:fabCustomSize equal to your custom layout_width/layout_height size and app:maxImageSize equal to your icon size in order to ensure your icon is centered properly). Default value is FabSize.MINI. var fabOptionSize: FabSize |
firstFabOptionMarginPx |
The margin (in pixels as a positive float) between the first FabOption in this orientation and the ExpandableFab itself. Depending on the size you set for the ExpandableFab, you may want this margin to be different than successiveFabOptionMarginPx. Default value is 80f. var firstFabOptionMarginPx: Float |
iconAnimationRotationDeg |
A float, in degrees, representing how much the ExpandableFab's icon will rotate when animating. When opening, the ExpandableFab will rotate from 0 to this value. When closing, the icon will rotate from this value to its initial position of 0. Default value is -135f. var iconAnimationRotationDeg: Float |
label |
The optional label attached to this ExpandableFab. The label will only be shown when its labelText is not null. Default values for the label are as follows: val label: Label |
openingAnimationDurationMs |
The duration (in milliseconds as a positive long) of the ExpandableFab's opening animations. Default value is 250L. var openingAnimationDurationMs: Long |
orientation |
The Orientation this ExpandableFab is viewable in. Default value is Orientation.PORTRAIT. var orientation: Orientation |
successiveFabOptionMarginPx |
The margin (in pixels as a positive float) between successive FabOptions in this ExpandableFab orientation. See firstFabOptionMarginPx if trying to set the margin between the first FabOption in this orientation and the ExpandableFab itself. Default value is 75f. var successiveFabOptionMarginPx: Float |
hide |
Hides the ExpandableFab and optional label. fun hide(): Unit |
onDetachedFromWindow |
Called when the view is detached from a window. At this point it no longer has a surface for drawing. Stops any animations on the ExpandableFab, as it's no longer on screen. fun onDetachedFromWindow(): Unit |
setOnClickListener |
Registers a callback to be invoked when this ExpandableFab or its label is clicked. The default behavior the ExpandableFab will be executed before this custom callback. fun setOnClickListener(onClickListener: OnClickListener?): Unit |
setSize |
Sets the size of the ExpandableFab. Overridden to ensure we never set the size to be FabSize.CUSTOM. fun setSize(size: Int): Unit |
show |
Shows the ExpandableFab and optional label. fun show(): Unit |