FloatingActionButton

public class FloatingActionButton
extends ImageButton implements TintableBackgroundView, TintableImageSourceView, ExpandableTransformationWidget, Shapeable, CoordinatorLayout.AttachedBehavior

java.lang.Object
   ↳ android.view.View
     ↳ android.widget.ImageView
       ↳ android.widget.ImageButton
         ↳ com.google.android.material.floatingactionbutton.FloatingActionButton


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(Drawable).

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(ColorStateList).

For more information, see the component developer guidance and design guidelines.

Summary

Nested classes

class FloatingActionButton.BaseBehavior<T extends FloatingActionButton>

Behavior designed for use with FloatingActionButton instances. 

class FloatingActionButton.Behavior

Behavior designed for use with FloatingActionButton instances. 

class FloatingActionButton.OnVisibilityChangedListener

Callback to be invoked when the visibility of a FloatingActionButton changes. 

XML attributes

FloatingActionButton_elevation  
FloatingActionButton_ensureMinTouchTargetSize  
FloatingActionButton_fabCustomSize  
FloatingActionButton_fabSize  
FloatingActionButton_hideMotionSpec  
FloatingActionButton_hoveredFocusedTranslationZ  
FloatingActionButton_maxImageSize  
FloatingActionButton_pressedTranslationZ  
FloatingActionButton_rippleColor  
FloatingActionButton_showMotionSpec  
FloatingActionButton_useCompatPadding  

Constants

int NO_CUSTOM_SIZE

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(int) or the fabSize attribute.

int SIZE_AUTO

Size which will change based on the window size.

int SIZE_MINI

The mini sized button, 40dp.

int SIZE_NORMAL

The normal sized button, 56dp.

Inherited constants

Inherited fields

Public constructors

FloatingActionButton(Context context)
FloatingActionButton(Context context, AttributeSet attrs)
FloatingActionButton(Context context, AttributeSet attrs, int defStyleAttr)

Public methods

void addOnHideAnimationListener(Animator.AnimatorListener listener)
void addOnShowAnimationListener(Animator.AnimatorListener listener)
void addTransformationCallback(TransformationCallback<? extends FloatingActionButton> listener)

Add a TransformationCallback which can watch for changes to this view.

void clearCustomSize()

Clears the custom size for this FloatingActionButton.

ColorStateList getBackgroundTintList()

Returns the tint applied to the background drawable, if specified.

PorterDuff.Mode getBackgroundTintMode()

Returns the blending mode used to apply the tint to the background drawable, if specified.

Behavior<FloatingActionButton> getBehavior()
float getCompatElevation()

Returns the backward compatible elevation of the FloatingActionButton.

float getCompatHoveredFocusedTranslationZ()

Returns the backward compatible hovered/focused translationZ of the FloatingActionButton.

float getCompatPressedTranslationZ()

Returns the backward compatible pressed translationZ of the FloatingActionButton.

Drawable getContentBackground()

Returns the FloatingActionButton's background, minus any compatible shadow implementation.

boolean getContentRect(Rect rect)

This method is deprecated. prefer getMeasuredContentRect(Rect) instead, so you don't need to handle the case where the view isn't laid out.

int getCustomSize()

Returns the custom size for this FloatingActionButton.

int getExpandedComponentIdHint()

Returns the expanded component id hint.

MotionSpec getHideMotionSpec()

Returns the motion spec for the hide animation.

void getMeasuredContentRect(Rect rect)

Return in rect the bounds of the actual floating action button content in view-local coordinates.

int getRippleColor()

This method is deprecated. Use getRippleColorStateList() instead.

ColorStateList getRippleColorStateList()

Returns the ripple color for this button.

ShapeAppearanceModel getShapeAppearanceModel()

Returns the ShapeAppearanceModel for this FloatingActionButton.

MotionSpec getShowMotionSpec()

Returns the motion spec for the show animation.

int getSize()

Returns the chosen size for this button.

ColorStateList getSupportBackgroundTintList()

Compat method to support TintableBackgroundView.

PorterDuff.Mode getSupportBackgroundTintMode()

Compat method to support TintableBackgroundView.

ColorStateList getSupportImageTintList()
PorterDuff.Mode getSupportImageTintMode()
boolean getUseCompatPadding()

Returns whether FloatingActionButton will add inner padding on platforms Lollipop and after.

final int getUserSetVisibility()
void hide()

Hides the button.

void hide(FloatingActionButton.OnVisibilityChangedListener listener)

Hides the button.

final void internalSetVisibility(int visibility, boolean fromUser)
boolean isExpanded()

Returns whether this widget is expanded.

boolean isOrWillBeHidden()
boolean isOrWillBeShown()
void jumpDrawablesToCurrentState()
boolean onTouchEvent(MotionEvent ev)
void removeOnHideAnimationListener(Animator.AnimatorListener listener)
void removeOnShowAnimationListener(Animator.AnimatorListener listener)
void removeTransformationCallback(TransformationCallback<? extends FloatingActionButton> listener)

Remove the TransformationCallback from this view.

void setBackgroundColor(int color)
void setBackgroundDrawable(Drawable background)
void setBackgroundResource(int resid)
void setBackgroundTintList(ColorStateList tint)

Applies a tint to the background drawable.

void setBackgroundTintMode(PorterDuff.Mode tintMode)

Specifies the blending mode used to apply the tint specified by setBackgroundTintList(ColorStateList)} to the background drawable.

void setCompatElevation(float elevation)

Updates the backward compatible elevation of the FloatingActionButton.

void setCompatElevationResource(int id)

Updates the backward compatible elevation of the FloatingActionButton.

void setCompatHoveredFocusedTranslationZ(float translationZ)

Updates the backward compatible hovered/focused translationZ of the FloatingActionButton.

void setCompatHoveredFocusedTranslationZResource(int id)

Updates the backward compatible hovered/focused translationZ of the FloatingActionButton.

void setCompatPressedTranslationZ(float translationZ)

Updates the backward compatible pressed translationZ of the FloatingActionButton.

void setCompatPressedTranslationZResource(int id)

Updates the backward compatible pressed translationZ of the FloatingActionButton.

void setCustomSize(int size)

Sets the size of the button to be a custom value in pixels.

void setElevation(float elevation)
void setEnsureMinTouchTargetSize(boolean flag)

Sets whether this FloatingActionButton should expand its bounds (if needed) to meet the minimum touch target size.

boolean setExpanded(boolean expanded)

Sets the expanded state on this widget.

void setExpandedComponentIdHint(int expandedComponentIdHint)

Sets the expanded component id hint, which may be used by a Behavior to determine whether it should handle this widget's state change.

void setHideMotionSpec(MotionSpec spec)

Updates the motion spec for the hide animation.

void setHideMotionSpecResource(int id)

Updates the motion spec for the hide animation.

void setImageDrawable(Drawable drawable)
void setImageResource(int resId)
void setMaxImageSize(int imageSize)

Sets the max image size for this button.

void setRippleColor(ColorStateList color)

Sets the ripple color for this button.

void setRippleColor(int color)

Sets the ripple color for this button.

void setScaleX(float scaleX)
void setScaleY(float scaleY)
void setShapeAppearanceModel(ShapeAppearanceModel shapeAppearance)

Sets the ShapeAppearanceModel for this FloatingActionButton.

void setShowMotionSpec(MotionSpec spec)

Updates the motion spec for the show animation.

void setShowMotionSpecResource(int id)

Updates the motion spec for the show animation.

void setSize(int size)

Sets the size of the button.

void setSupportBackgroundTintList(ColorStateList tint)

Compat method to support TintableBackgroundView.

void setSupportBackgroundTintMode(PorterDuff.Mode tintMode)

Compat method to support TintableBackgroundView.

void setSupportImageTintList(ColorStateList tint)
void setSupportImageTintMode(PorterDuff.Mode tintMode)
void setTranslationX(float translationX)
void setTranslationY(float translationY)
void setTranslationZ(float translationZ)
void setUseCompatPadding(boolean useCompatPadding)

Set whether FloatingActionButton should add inner padding on platforms Lollipop and after, to ensure consistent dimensions on all platforms.

void setVisibility(int visibility)
boolean shouldEnsureMinTouchTargetSize()

Returns whether this fab will expand its bounds (if needed) to meet the minimum touch target size.

void show()

Shows the button.

void show(FloatingActionButton.OnVisibilityChangedListener listener)

Shows the button.

Protected methods

void drawableStateChanged()
void onAttachedToWindow()
void onDetachedFromWindow()
void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
void onRestoreInstanceState(Parcelable state)
Parcelable onSaveInstanceState()

Inherited methods

XML attributes

FloatingActionButton_elevation

Related methods:

FloatingActionButton_ensureMinTouchTargetSize

Related methods:

FloatingActionButton_fabCustomSize

Related methods:

FloatingActionButton_fabSize

Related methods:

FloatingActionButton_hideMotionSpec

Related methods:

FloatingActionButton_hoveredFocusedTranslationZ

Related methods:

FloatingActionButton_maxImageSize

Related methods:

FloatingActionButton_pressedTranslationZ

Related methods:

FloatingActionButton_rippleColor

Related methods:

FloatingActionButton_showMotionSpec

Related methods:

FloatingActionButton_useCompatPadding

Related methods:

Constants

NO_CUSTOM_SIZE

public static final int NO_CUSTOM_SIZE

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(int) or the fabSize attribute. Instead of using this constant directly, you can call the clearCustomSize() method.

Constant Value: 0 (0x00000000)

SIZE_AUTO

public static final int SIZE_AUTO

Size which will change based on the window size. For small sized windows (largest screen dimension < 470dp) this will select a mini sized button (SIZE_MINI), and for larger sized windows it will select a normal sized button (SIZE_NORMAL).

See also:

Constant Value: -1 (0xffffffff)

SIZE_MINI

public static final int SIZE_MINI

The mini sized button, 40dp. Will always be smaller than SIZE_NORMAL.

See also:

Constant Value: 1 (0x00000001)

SIZE_NORMAL

public static final int SIZE_NORMAL

The normal sized button, 56dp. Will always be larger than SIZE_MINI.

See also:

Constant Value: 0 (0x00000000)

Public constructors

FloatingActionButton

public FloatingActionButton (Context context)

Parameters
context Context

FloatingActionButton

public FloatingActionButton (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

FloatingActionButton

public FloatingActionButton (Context context, 
                AttributeSet attrs, 
                int defStyleAttr)

Parameters
context Context

attrs AttributeSet

defStyleAttr int

Public methods

addOnHideAnimationListener

public void addOnHideAnimationListener (Animator.AnimatorListener listener)

Parameters
listener Animator.AnimatorListener

addOnShowAnimationListener

public void addOnShowAnimationListener (Animator.AnimatorListener listener)

Parameters
listener Animator.AnimatorListener

addTransformationCallback

public void addTransformationCallback (TransformationCallback<? extends FloatingActionButton> listener)

Add a TransformationCallback which can watch for changes to this view.

Parameters
listener TransformationCallback

clearCustomSize

public void clearCustomSize ()

Clears the custom size for this FloatingActionButton.

If called, custom sizing will not be used and the size will be calculated based on the value set using setSize(int) or the fabSize attribute

getBackgroundTintList

public ColorStateList getBackgroundTintList ()

Returns the tint applied to the background drawable, if specified.

Returns
ColorStateList the tint applied to the background drawable

getBackgroundTintMode

public PorterDuff.Mode getBackgroundTintMode ()

Returns the blending mode used to apply the tint to the background drawable, if specified.

Returns
PorterDuff.Mode the blending mode used to apply the tint to the background drawable

getBehavior

public Behavior<FloatingActionButton> getBehavior ()

Returns
Behavior<FloatingActionButton>

getCompatElevation

public float getCompatElevation ()

Returns the backward compatible elevation of the FloatingActionButton.

Related XML Attributes:

Returns
float the backward compatible elevation in pixels.

getCompatHoveredFocusedTranslationZ

public float getCompatHoveredFocusedTranslationZ ()

Returns the backward compatible hovered/focused translationZ of the FloatingActionButton.

Related XML Attributes:

Returns
float the backward compatible hovered/focused translationZ in pixels.

getCompatPressedTranslationZ

public float getCompatPressedTranslationZ ()

Returns the backward compatible pressed translationZ of the FloatingActionButton.

Related XML Attributes:

Returns
float the backward compatible pressed translationZ in pixels.

getContentBackground

public Drawable getContentBackground ()

Returns the FloatingActionButton's background, minus any compatible shadow implementation.

Returns
Drawable

getContentRect

public boolean getContentRect (Rect rect)

This method is deprecated.
prefer getMeasuredContentRect(Rect) instead, so you don't need to handle the case where the view isn't laid out.

Return in rect the bounds of the actual floating action button content in view-local coordinates. This is defined as anything within any visible shadow.

Parameters
rect Rect

Returns
boolean true if this view actually has been laid out and has a content rect, else false.

getCustomSize

public int getCustomSize ()

Returns the custom size for this FloatingActionButton.

Returns
int size in pixels, or NO_CUSTOM_SIZE

getExpandedComponentIdHint

public int getExpandedComponentIdHint ()

Returns the expanded component id hint.

Returns
int

getHideMotionSpec

public MotionSpec getHideMotionSpec ()

Returns the motion spec for the hide animation.

Returns
MotionSpec

getMeasuredContentRect

public void getMeasuredContentRect (Rect rect)

Return in rect the bounds of the actual floating action button content in view-local coordinates. This is defined as anything within any visible shadow.

Parameters
rect Rect

getRippleColor

public int getRippleColor ()

This method is deprecated.
Use getRippleColorStateList() instead.

Returns the ripple color for this button.

Returns
int the ARGB color used for the ripple

getRippleColorStateList

public ColorStateList getRippleColorStateList ()

Returns the ripple color for this button.

Returns
ColorStateList the color state list used for the ripple

getShapeAppearanceModel

public ShapeAppearanceModel getShapeAppearanceModel ()

Returns the ShapeAppearanceModel for this FloatingActionButton.

Returns
ShapeAppearanceModel

getShowMotionSpec

public MotionSpec getShowMotionSpec ()

Returns the motion spec for the show animation.

Returns
MotionSpec

getSize

public int getSize ()

Returns the chosen size for this button.

Returns
int one of SIZE_NORMAL, SIZE_MINI or SIZE_AUTO

See also:

getSupportBackgroundTintList

public ColorStateList getSupportBackgroundTintList ()

Compat method to support TintableBackgroundView. Use getBackgroundTintList() directly instead.

Returns
ColorStateList

getSupportBackgroundTintMode

public PorterDuff.Mode getSupportBackgroundTintMode ()

Compat method to support TintableBackgroundView. Use getBackgroundTintMode() directly instead.

Returns
PorterDuff.Mode

getSupportImageTintList

public ColorStateList getSupportImageTintList ()

Returns
ColorStateList

getSupportImageTintMode

public PorterDuff.Mode getSupportImageTintMode ()

Returns
PorterDuff.Mode

getUseCompatPadding

public boolean getUseCompatPadding ()

Returns whether FloatingActionButton will add inner padding on platforms Lollipop and after.

Related XML Attributes:

Returns
boolean true if FloatingActionButton is adding inner padding on platforms Lollipop and after, to ensure consistent dimensions on all platforms.

getUserSetVisibility

public final int getUserSetVisibility ()

Returns
int

hide

public void hide ()

Hides the button.

This method will animate the button hide if the view has already been laid out.

hide

public void hide (FloatingActionButton.OnVisibilityChangedListener listener)

Hides the button.

This method will animate the button hide if the view has already been laid out.

Parameters
listener FloatingActionButton.OnVisibilityChangedListener: the listener to notify when this view is hidden

internalSetVisibility

public final void internalSetVisibility (int visibility, 
                boolean fromUser)

Parameters
visibility int

fromUser boolean

isExpanded

public boolean isExpanded ()

Returns whether this widget is expanded.

Implementations should call ExpandableWidgetHelper.isExpanded().

Returns
boolean

isOrWillBeHidden

public boolean isOrWillBeHidden ()

Returns
boolean

isOrWillBeShown

public boolean isOrWillBeShown ()

Returns
boolean

jumpDrawablesToCurrentState

public void jumpDrawablesToCurrentState ()

onTouchEvent

public boolean onTouchEvent (MotionEvent ev)

Parameters
ev MotionEvent

Returns
boolean

removeOnHideAnimationListener

public void removeOnHideAnimationListener (Animator.AnimatorListener listener)

Parameters
listener Animator.AnimatorListener

removeOnShowAnimationListener

public void removeOnShowAnimationListener (Animator.AnimatorListener listener)

Parameters
listener Animator.AnimatorListener

removeTransformationCallback

public void removeTransformationCallback (TransformationCallback<? extends FloatingActionButton> listener)

Remove the TransformationCallback from this view. It will no longer receive updates when this view is transformed.

Parameters
listener TransformationCallback

setBackgroundColor

public void setBackgroundColor (int color)

Parameters
color int

setBackgroundDrawable

public void setBackgroundDrawable (Drawable background)

Parameters
background Drawable

setBackgroundResource

public void setBackgroundResource (int resid)

Parameters
resid int

setBackgroundTintList

public void setBackgroundTintList (ColorStateList tint)

Applies a tint to the background drawable. Does not modify the current tint mode, which is PorterDuff.Mode.SRC_IN by default.

Parameters
tint ColorStateList: the tint to apply, may be null to clear tint

setBackgroundTintMode

public void setBackgroundTintMode (PorterDuff.Mode tintMode)

Specifies the blending mode used to apply the tint specified by setBackgroundTintList(ColorStateList)} to the background drawable. The default mode is PorterDuff.Mode.SRC_IN.

Parameters
tintMode PorterDuff.Mode: the blending mode used to apply the tint, may be null to clear tint

setCompatElevation

public void setCompatElevation (float elevation)

Updates the backward compatible elevation of the FloatingActionButton.

Related XML Attributes:

Parameters
elevation float: The backward compatible elevation in pixels.

setCompatElevationResource

public void setCompatElevationResource (int id)

Updates the backward compatible elevation of the FloatingActionButton.

Related XML Attributes:

Parameters
id int: The resource id of the backward compatible elevation.

setCompatHoveredFocusedTranslationZ

public void setCompatHoveredFocusedTranslationZ (float translationZ)

Updates the backward compatible hovered/focused translationZ of the FloatingActionButton.

Related XML Attributes:

Parameters
translationZ float: The backward compatible hovered/focused translationZ in pixels.

setCompatHoveredFocusedTranslationZResource

public void setCompatHoveredFocusedTranslationZResource (int id)

Updates the backward compatible hovered/focused translationZ of the FloatingActionButton.

Related XML Attributes:

Parameters
id int: The resource id of the backward compatible hovered/focused translationZ.

setCompatPressedTranslationZ

public void setCompatPressedTranslationZ (float translationZ)

Updates the backward compatible pressed translationZ of the FloatingActionButton.

Related XML Attributes:

Parameters
translationZ float: The backward compatible pressed translationZ in pixels.

setCompatPressedTranslationZResource

public void setCompatPressedTranslationZResource (int id)

Updates the backward compatible pressed translationZ of the FloatingActionButton.

Related XML Attributes:

Parameters
id int: The resource id of the backward compatible pressed translationZ.

setCustomSize

public void setCustomSize (int size)

Sets the size of the button to be a custom value in pixels.

If you've set a custom size and would like to clear it, you can use the clearCustomSize() method. If called, custom sizing will not be used and the size will be calculated based on the value set using setSize(int) or the fabSize attribute.

Related XML Attributes:

Parameters
size int: preferred size in pixels, or NO_CUSTOM_SIZE

setElevation

public void setElevation (float elevation)

Parameters
elevation float

setEnsureMinTouchTargetSize

public void setEnsureMinTouchTargetSize (boolean flag)

Sets whether this FloatingActionButton should expand its bounds (if needed) to meet the minimum touch target size.

Related XML Attributes:

Parameters
flag boolean

setExpanded

public boolean setExpanded (boolean expanded)

Sets the expanded state on this widget.

Implementations should call ExpandableWidgetHelper.setExpanded(boolean).

Parameters
expanded boolean

Returns
boolean true if the expanded state changed as a result of this call.

setExpandedComponentIdHint

public void setExpandedComponentIdHint (int expandedComponentIdHint)

Sets the expanded component id hint, which may be used by a Behavior to determine whether it should handle this widget's state change.

Parameters
expandedComponentIdHint int

setHideMotionSpec

public void setHideMotionSpec (MotionSpec spec)

Updates the motion spec for the hide animation.

Related XML Attributes:

Parameters
spec MotionSpec

setHideMotionSpecResource

public void setHideMotionSpecResource (int id)

Updates the motion spec for the hide animation.

Related XML Attributes:

Parameters
id int

setImageDrawable

public void setImageDrawable (Drawable drawable)

Parameters
drawable Drawable

setImageResource

public void setImageResource (int resId)

Parameters
resId int

setMaxImageSize

public void setMaxImageSize (int imageSize)

Sets the max image size for this button.

Related XML Attributes:

Parameters
imageSize int: maximum icon image size

setRippleColor

public void setRippleColor (ColorStateList color)

Sets the ripple color for this button.

When running on devices with KitKat or below, we draw this color as a filled circle rather than a ripple.

Related XML Attributes:

Parameters
color ColorStateList: color state list to use for the ripple

See also:

setRippleColor

public void setRippleColor (int color)

Sets the ripple color for this button.

When running on devices with KitKat or below, we draw this color as a filled circle rather than a ripple.

Related XML Attributes:

Parameters
color int: ARGB color to use for the ripple

See also:

setScaleX

public void setScaleX (float scaleX)

Parameters
scaleX float

setScaleY

public void setScaleY (float scaleY)

Parameters
scaleY float

setShapeAppearanceModel

public void setShapeAppearanceModel (ShapeAppearanceModel shapeAppearance)

Sets the ShapeAppearanceModel for this FloatingActionButton.

Parameters
shapeAppearance ShapeAppearanceModel

setShowMotionSpec

public void setShowMotionSpec (MotionSpec spec)

Updates the motion spec for the show animation.

Related XML Attributes:

Parameters
spec MotionSpec

setShowMotionSpecResource

public void setShowMotionSpecResource (int id)

Updates the motion spec for the show animation.

Related XML Attributes:

Parameters
id int

setSize

public void setSize (int size)

Sets the size of the button.

The options relate to the options available on the material design specification. SIZE_NORMAL is larger than SIZE_MINI. SIZE_AUTO will choose an appropriate size based on the screen size.

Calling this method will turn off custom sizing (see setCustomSize(int)) if it was previously on.

Related XML Attributes:

Parameters
size int: one of SIZE_NORMAL, SIZE_MINI or SIZE_AUTO

setSupportBackgroundTintList

public void setSupportBackgroundTintList (ColorStateList tint)

Compat method to support TintableBackgroundView. Use setBackgroundTintList(ColorStateList) directly instead.

Parameters
tint ColorStateList

setSupportBackgroundTintMode

public void setSupportBackgroundTintMode (PorterDuff.Mode tintMode)

Compat method to support TintableBackgroundView. Use setBackgroundTintMode(Mode) directly instead.

Parameters
tintMode PorterDuff.Mode

setSupportImageTintList

public void setSupportImageTintList (ColorStateList tint)

Parameters
tint ColorStateList

setSupportImageTintMode

public void setSupportImageTintMode (PorterDuff.Mode tintMode)

Parameters
tintMode PorterDuff.Mode

setTranslationX

public void setTranslationX (float translationX)

Parameters
translationX float

setTranslationY

public void setTranslationY (float translationY)

Parameters
translationY float

setTranslationZ

public void setTranslationZ (float translationZ)

Parameters
translationZ float

setUseCompatPadding

public void setUseCompatPadding (boolean useCompatPadding)

Set whether FloatingActionButton should add inner padding on platforms Lollipop and after, to ensure consistent dimensions on all platforms.

Related XML Attributes:

Parameters
useCompatPadding boolean: true if FloatingActionButton is adding inner padding on platforms Lollipop and after, to ensure consistent dimensions on all platforms.

setVisibility

public void setVisibility (int visibility)

Parameters
visibility int

shouldEnsureMinTouchTargetSize

public boolean shouldEnsureMinTouchTargetSize ()

Returns whether this fab will expand its bounds (if needed) to meet the minimum touch target size.

Related XML Attributes:

Returns
boolean

show

public void show ()

Shows the button.

This method will animate the button show if the view has already been laid out.

show

public void show (FloatingActionButton.OnVisibilityChangedListener listener)

Shows the button.

This method will animate the button show if the view has already been laid out.

Parameters
listener FloatingActionButton.OnVisibilityChangedListener: the listener to notify when this view is shown

Protected methods

drawableStateChanged

protected void drawableStateChanged ()

onAttachedToWindow

protected void onAttachedToWindow ()

onDetachedFromWindow

protected void onDetachedFromWindow ()

onMeasure

protected void onMeasure (int widthMeasureSpec, 
                int heightMeasureSpec)

Parameters
widthMeasureSpec int

heightMeasureSpec int

onRestoreInstanceState

protected void onRestoreInstanceState (Parcelable state)

Parameters
state Parcelable

onSaveInstanceState

protected Parcelable onSaveInstanceState ()

Returns
Parcelable