Floating Action Button
open class FloatingActionButton : VisibilityAwareImageButton, TintableBackgroundView, TintableImageSourceView, ExpandableTransformationWidget, Shapeable, CoordinatorLayout.AttachedBehavior
Floating action buttons are used for a special type of promoted action. They are distinguished by a circled icon floating above the UI and have special motion behaviors related to morphing, launching, and the transferring anchor point.
Floating action buttons come in two sizes: the default and the mini. The size can be controlled with the fabSize
attribute.
As this class descends from ImageView, you can control the icon which is displayed via setImageDrawable.
The background color of this view defaults to the your theme's colorSecondary
. If you wish to change this at runtime then you can do so via setBackgroundTintList.
For more information, see the component developer guidance and design guidelines.
Types
Link copied to clipboard
Behavior designed for use with FloatingActionButton instances.
Link copied to clipboard
Callback to be invoked when the visibility of a FloatingActionButton changes.
Link copied to clipboard
Properties
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Indicates that the FloatingActionButton should not have a custom size, and instead that the size should be calculated based on the value set using setSize or the
fabSize
attribute.Link copied to clipboard
The normal sized button, 56dp.
Functions
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun addTransformationCallback(@NonNull listener: TransformationCallback<out FloatingActionButton>)
Add a TransformationCallback which can watch for changes to this view.
Link copied to clipboard
Clears the custom size for this FloatingActionButton.
Link copied to clipboard
Returns the tint applied to the background drawable, if specified.
Link copied to clipboard
Link copied to clipboard
Returns the backward compatible elevation of the FloatingActionButton.
Link copied to clipboard
Returns the backward compatible hovered/focused translationZ of the FloatingActionButton.
Link copied to clipboard
Returns the backward compatible pressed translationZ of the FloatingActionButton.
Link copied to clipboard
Returns the FloatingActionButton's background, minus any compatible shadow implementation.
Link copied to clipboard
Return in
rect
the bounds of the actual floating action button content in view-local coordinates.Link copied to clipboard
Returns the expanded component id hint.
Link copied to clipboard
Returns the motion spec for the hide animation.
Link copied to clipboard
Return in
rect
the bounds of the actual floating action button content in view-local coordinates.Link copied to clipboard
Returns the ripple color for this button.
Link copied to clipboard
Returns the ripple color for this button.
Link copied to clipboard
Returns the ShapeAppearanceModel for this FloatingActionButton.
Link copied to clipboard
Returns the motion spec for the show animation.
Link copied to clipboard
Compat method to support TintableBackgroundView.
Link copied to clipboard
Compat method to support TintableBackgroundView.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Returns whether FloatingActionButton will add inner padding on platforms Lollipop and after.
Link copied to clipboard
Hides the button.
Link copied to clipboard
Returns whether this widget is expanded.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun removeTransformationCallback(@NonNull listener: TransformationCallback<out FloatingActionButton>)
Remove the TransformationCallback from this view.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Applies a tint to the background drawable.
Link copied to clipboard
Updates the backward compatible elevation of the FloatingActionButton.
Link copied to clipboard
Updates the backward compatible elevation of the FloatingActionButton.
Link copied to clipboard
Updates the backward compatible hovered/focused translationZ of the FloatingActionButton.
Link copied to clipboard
Updates the backward compatible hovered/focused translationZ of the FloatingActionButton.
Link copied to clipboard
Updates the backward compatible pressed translationZ of the FloatingActionButton.
Link copied to clipboard
Updates the backward compatible pressed translationZ of the FloatingActionButton.
Link copied to clipboard
Link copied to clipboard
Sets whether this FloatingActionButton should expand its bounds (if needed) to meet the minimum touch target size.
Link copied to clipboard
Sets the expanded state on this widget.
Link copied to clipboard
Sets the expanded component id hint, which may be used by a Behavior to determine whether it should handle this widget's state change.
Link copied to clipboard
Updates the motion spec for the hide animation.
Link copied to clipboard
Updates the motion spec for the hide animation.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Sets the max image size for this button.
Link copied to clipboard
Sets the ripple color for this button.
Link copied to clipboard
Set whether padding to show compat shadows should be added.
Link copied to clipboard
Sets the ShapeAppearanceModel for this FloatingActionButton.
Link copied to clipboard
Updates the motion spec for the show animation.
Link copied to clipboard
Updates the motion spec for the show animation.
Link copied to clipboard
Compat method to support TintableBackgroundView.
Link copied to clipboard
Compat method to support TintableBackgroundView.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Set whether FloatingActionButton should add inner padding on platforms Lollipop and after, to ensure consistent dimensions on all platforms.
Link copied to clipboard
Link copied to clipboard
Returns whether this fab will expand its bounds (if needed) to meet the minimum touch target size.
Link copied to clipboard
Shows the button.