# ExtendedFloatingActionButton

[View Source](https://github.com/material-components/material-components-android/blob/1.14.0/lib/java/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton.java)

*** ** * ** ***


```
public class ExtendedFloatingActionButton extends MaterialButton
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) |||
| ↳ | [com.google.android.material.button.MaterialButton](https://developer.android.com/reference/com/google/android/material/button/MaterialButton) ||
|   | ↳ | [com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton](https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton) |

*** ** * ** ***

Extended floating action buttons are used for a special type of promoted action. They are distinguished by an icon and a text floating above the UI and have special motion behaviors related to morphing, launching, and the transferring anchor point.

Extended floating action buttons may have icon and text, but may also hold just an icon or text.

As this class descends from `https://developer.android.com/reference/com/google/android/material/button/MaterialButton`, you can control the icon which is displayed via `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setIcon(Drawable)`, and the text via setText.

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 `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setBackgroundTintList(ColorStateList)`.

For more information, see the [component developer guidance](https://github.com/material-components/material-components-android/blob/master/docs/components/FloatingActionButton.md) and [design guidelines](https://material.io/components/extended-fab/overview).

## Summary

| ### Nested types |
|---|
| `protected class https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton.ExtendedFloatingActionButtonBehavior<T extends https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton>` Behavior designed for use with `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton` instances. |
| `public abstract class https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton.OnChangedCallback` Callback to be invoked when the visibility or the state of an ExtendedFloatingActionButton changes. |

| ### Public fields |
|---|---|
| `final Behavior<ExtendedFloatingActionButton>` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#behavior()` |
| `int` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#collapsedSize()` |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#isExtended()` |

| ### Protected fields |
|---|---|
| `ColorStateList` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#originalTextCsl()` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#ExtendedFloatingActionButton(Context)(Context context)` |
| `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#ExtendedFloatingActionButton(Context,AttributeSet)(Context context, AttributeSet attrs)` |
| `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#ExtendedFloatingActionButton(Context,AttributeSet,int)( Context context, AttributeSet attrs, int defStyleAttr )` |

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#addOnExtendAnimationListener(AnimatorListener)(AnimatorListener listener)` Add a listener that will be invoked when this ExtendedFloatingActionButton is extended. |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#addOnHideAnimationListener(AnimatorListener)(AnimatorListener listener)` Add a listener that will be invoked when this ExtendedFloatingActionButton is hidden. |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#addOnShowAnimationListener(AnimatorListener)(AnimatorListener listener)` Add a listener that will be invoked when this ExtendedFloatingActionButton is shown. |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#addOnShrinkAnimationListener(AnimatorListener)(AnimatorListener listener)` Add a listener that will be invoked when this ExtendedFloatingActionButton is shrunk. |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#extend()()` Extends the FAB to show the text and the icon. |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#extend(com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.OnChangedCallback)(https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton.OnChangedCallback callback)` Extends the FAB to show the text and the icon. |
| `https://developer.android.com/reference/java/lang/CharSequence` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#getAccessibilityClassName()()` |
| `Behavior<ExtendedFloatingActionButton>` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#getBehavior()()` |
| `int` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#getCollapsedSize()()` Shrink to the smaller value between paddingStart and paddingEnd, such that when shrunk the icon will be centered. |
| `https://developer.android.com/reference/com/google/android/material/animation/MotionSpec` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#getExtendMotionSpec()()` Returns the motion spec for the extend animation. |
| `https://developer.android.com/reference/com/google/android/material/animation/MotionSpec` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#getHideMotionSpec()()` Returns the motion spec for the hide animation. |
| `https://developer.android.com/reference/com/google/android/material/animation/MotionSpec` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#getShowMotionSpec()()` Returns the motion spec for the show animation. |
| `https://developer.android.com/reference/com/google/android/material/animation/MotionSpec` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#getShrinkMotionSpec()()` Returns the motion spec for the shrink animation. |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#hide()()` Hides the button. |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#hide(com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.OnChangedCallback)(https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton.OnChangedCallback callback)` Hides the button. |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#isAnimationEnabled()()` Return whether or not animations are enabled. |
| `final boolean` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#isExtended()()` |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#removeOnExtendAnimationListener(AnimatorListener)(AnimatorListener listener)` Remove a listener that was previously added via `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#addOnExtendAnimationListener(AnimatorListener)`. |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#removeOnHideAnimationListener(AnimatorListener)(AnimatorListener listener)` Remove a listener that was previously added via `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#addOnHideAnimationListener(AnimatorListener)`. |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#removeOnShowAnimationListener(AnimatorListener)(AnimatorListener listener)` Remove a listener that was previously added via `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#addOnShowAnimationListener(AnimatorListener)`. |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#removeOnShrinkAnimationListener(AnimatorListener)(AnimatorListener listener)` Remove a listener that was previously added via `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#addOnShrinkAnimationListener(AnimatorListener)`. |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#setAnimateShowBeforeLayout(boolean)(boolean animateShowBeforeLayout)` Sets whether to enable animation for a call to show show even if the view has not been laid out yet. |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#setAnimationEnabled(boolean)(boolean animationEnabled)` Set whether or not animations are enabled. |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#setClickable(boolean)(boolean clickable)` Sets the clickable state of this view. |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#setCollapsedSize(int)(int collapsedSize)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#setContentDescription(java.lang.CharSequence)(https://developer.android.com/reference/java/lang/CharSequence contentDescription)` Sets the content description for this view. |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#setExtendMotionSpec(com.google.android.material.animation.MotionSpec)(https://developer.android.com/reference/com/google/android/material/animation/MotionSpec spec)` Updates the motion spec for the extend animation. |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#setExtendMotionSpecResource(int)(int id)` Updates the motion spec for the extend animation. |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#setExtended(boolean)(boolean extended)` Extends or shrinks the fab depending on the value of {@param extended}. |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#setHideMotionSpec(com.google.android.material.animation.MotionSpec)(https://developer.android.com/reference/com/google/android/material/animation/MotionSpec spec)` Updates the motion spec for the hide animation. |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#setHideMotionSpecResource(int)(int id)` Updates the motion spec for the hide animation. |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#setPadding(int,int,int,int)(int left, int top, int right, int bottom)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#setPaddingRelative(int,int,int,int)(int start, int top, int end, int bottom)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#setShowMotionSpec(com.google.android.material.animation.MotionSpec)(https://developer.android.com/reference/com/google/android/material/animation/MotionSpec spec)` Updates the motion spec for the show animation. |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#setShowMotionSpecResource(int)(int id)` Updates the motion spec for the show animation. |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#setShrinkMotionSpec(com.google.android.material.animation.MotionSpec)(https://developer.android.com/reference/com/google/android/material/animation/MotionSpec spec)` Updates the motion spec for the shrink animation. |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#setShrinkMotionSpecResource(int)(int id)` Updates the motion spec for the shrink animation. |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#setText(java.lang.CharSequence,BufferType)(https://developer.android.com/reference/java/lang/CharSequence text, BufferType type)` Sets the text to be displayed. |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#setTextColor(int)(int color)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#setTextColor(ColorStateList)(ColorStateList colors)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#show()()` Shows the button. |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#show(com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.OnChangedCallback)(https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton.OnChangedCallback callback)` Shows the button. |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#shrink()()` Shrinks the FAB to show just the icon. |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#shrink(com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.OnChangedCallback)(https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton.OnChangedCallback callback)` Shrinks the FAB to show just the icon. |

| ### Protected methods |
|---|---|
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#onAttachedToWindow()()` |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#silentlyUpdateTextColor(ColorStateList)(ColorStateList csl)` Update the text color without affecting the original, client-set color. |

| ### Inherited Constants |
|---|
| From [com.google.android.material.button.MaterialButton](https://developer.android.com/reference/com/google/android/material/button/MaterialButton) |---|---| | `static final int` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#ICON_GRAVITY_END() = 3` Gravity used to position the icon at the end of the view. | | `static final int` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#ICON_GRAVITY_START() = 1` Gravity used to position the icon at the start of the view. | | `static final int` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#ICON_GRAVITY_TEXT_END() = 4` Gravity used to position the icon in the center of the view at the end of the text | | `static final int` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#ICON_GRAVITY_TEXT_START() = 2` Gravity used to position the icon in the center of the view at the start of the text | | `static final int` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#ICON_GRAVITY_TEXT_TOP() = 32` Gravity used to position the icon in the center of the view at the top of the text | | `static final int` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#ICON_GRAVITY_TOP() = 16` Gravity used to position the icon at the top of the view. | |

| ### Inherited fields |
|---|
| From [com.google.android.material.button.MaterialButton](https://developer.android.com/reference/com/google/android/material/button/MaterialButton) |---|---| | `Drawable` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#icon()` | | `int` | `@https://developer.android.com/reference/com/google/android/material/button/MaterialButton.IconGravity https://developer.android.com/reference/com/google/android/material/button/MaterialButton#iconGravity()` | | `int` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#iconPadding()` | | `int` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#iconSize()` | | `ColorStateList` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#iconTint()` | | `Mode` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#iconTintMode()` | | `Drawable` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#secondaryIcon()` | | `int` | `@https://developer.android.com/reference/com/google/android/material/button/MaterialButton.IconGravity https://developer.android.com/reference/com/google/android/material/button/MaterialButton#secondaryIconGravity()` | | `ColorStateList` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#secondaryIconTint()` | | `Mode` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#secondaryIconTintMode()` | |

| ### Inherited methods |
|---|
| From [com.google.android.material.button.MaterialButton](https://developer.android.com/reference/com/google/android/material/button/MaterialButton) |---|---| | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#addOnCheckedChangeListener(com.google.android.material.button.MaterialButton.OnCheckedChangeListener)( https://developer.android.com/reference/com/google/android/material/button/MaterialButton.OnCheckedChangeListener listener )` Add a listener that will be invoked when the checked state of this MaterialButton changes. | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#clearOnCheckedChangeListeners()()` Remove all previously added `https://developer.android.com/reference/com/google/android/material/button/MaterialButton.OnCheckedChangeListener`s. | | `ColorStateList` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#getBackgroundTintList()()` | | `Mode` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#getBackgroundTintMode()()` | | `int` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#getCornerRadius()()` Gets the corner radius for this button. | | `Drawable` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#getIcon()()` Gets the icon shown for this button, if present. | | `int` | `@https://developer.android.com/reference/com/google/android/material/button/MaterialButton.IconGravity https://developer.android.com/reference/com/google/android/material/button/MaterialButton#getIconGravity()()` Gets the icon gravity for this button | | `int` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#getIconPadding()()` Gets the padding between the button icon and the button text, if icon is present. | | `int` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#getIconSize()()` Returns the size of the icon if it was set. | | `ColorStateList` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#getIconTint()()` Gets the tint list for the icon shown for this button. | | `Mode` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#getIconTintMode()()` Gets the tint mode for the icon shown for this button. | | `int` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#getInsetBottom()()` Gets the bottom inset for this button | | `int` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#getInsetLeft()()` Gets the left inset for this button. | | `int` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#getInsetRight()()` Gets the right inset for this button. | | `int` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#getInsetTop()()` Gets the top inset for this button | | `ColorStateList` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#getRippleColor()()` Gets the ripple color for this button. | | `Drawable` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#getSecondaryIcon()()` Gets the secondary icon for this button, if present. | | `int` | `@https://developer.android.com/reference/com/google/android/material/button/MaterialButton.IconGravity https://developer.android.com/reference/com/google/android/material/button/MaterialButton#getSecondaryIconGravity()()` Gets the secondary icon's gravity for this button. | | `ColorStateList` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#getSecondaryIconTint()()` Gets the tint list for the secondary icon shown for this button. | | `Mode` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#getSecondaryIconTintMode()()` Gets the tint mode for the secondary icon shown for this button. | | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#getShapeAppearanceModel()()` Returns the `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` used for this `https://developer.android.com/reference/com/google/android/material/button/MaterialButton`'s original drawables. | | `ColorStateList` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#getStrokeColor()()` Gets the stroke color for this button. | | `int` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#getStrokeWidth()()` Gets the stroke width for this button. | | `boolean` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#isCheckable()()` Returns whether this MaterialButton is checkable. | | `boolean` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#isChecked()()` | | `boolean` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#isOpticalCenterEnabled()()` Returns whether the optical center feature is enabled. | | `boolean` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#isToggleCheckedStateOnClick()()` Returns whether or not clicking the button will toggle the checked state. | | `int[]` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#onCreateDrawableState(int)(int extraSpace)` | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#onInitializeAccessibilityEvent(AccessibilityEvent)(AccessibilityEvent accessibilityEvent)` | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo)(AccessibilityNodeInfo info)` | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#onLayout(boolean,int,int,int,int)(boolean changed, int left, int top, int right, int bottom)` | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#onRestoreInstanceState(Parcelable)(Parcelable state)` | | `Parcelable` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#onSaveInstanceState()()` | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#onTextChanged(java.lang.CharSequence,int,int,int)(https://developer.android.com/reference/java/lang/CharSequence charSequence, int i, int i1, int i2)` | | `boolean` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#performClick()()` | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#refreshDrawableState()()` | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#removeOnCheckedChangeListener(com.google.android.material.button.MaterialButton.OnCheckedChangeListener)( https://developer.android.com/reference/com/google/android/material/button/MaterialButton.OnCheckedChangeListener listener )` Remove a listener that was previously added via `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#addOnCheckedChangeListener(com.google.android.material.button.MaterialButton.OnCheckedChangeListener)`. | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setA11yClassName(java.lang.String)(https://developer.android.com/reference/java/lang/String className)` | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setBackground(Drawable)(Drawable background)` | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setBackgroundColor(int)(int color)` | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setBackgroundDrawable(Drawable)(Drawable background)` | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setBackgroundResource(int)(int backgroundResourceId)` | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setBackgroundTintList(ColorStateList)(ColorStateList tintList)` | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setBackgroundTintMode(Mode)(Mode tintMode)` | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setCheckable(boolean)(boolean checkable)` Sets whether this MaterialButton is checkable. | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setChecked(boolean)(boolean checked)` | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setCompoundDrawablePadding(int)(int padding)` | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setCornerRadius(int)(int cornerRadius)` Sets the corner radius for this button. | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setCornerRadiusResource(int)(int cornerRadiusResourceId)` Sets the corner radius dimension resource for this button. | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setElevation(float)(float elevation)` | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setIcon(Drawable)(Drawable icon)` Sets the icon to show for this button. | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setIconGravity(int)(@https://developer.android.com/reference/com/google/android/material/button/MaterialButton.IconGravity int iconGravity)` Sets the icon gravity for this button | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setIconPadding(int)(int iconPadding)` Sets the padding between the button icon and the button text, if icon is present. | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setIconResource(int)(int iconResourceId)` Sets the icon drawable resource to show for this button. | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setIconSize(int)(int iconSize)` Sets the width and height of the icon. | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setIconTint(ColorStateList)(ColorStateList iconTint)` Sets the tint list for the icon shown for this button. | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setIconTintMode(Mode)(Mode iconTintMode)` Sets the tint mode for the icon shown for this button. | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setIconTintResource(int)(int iconTintResourceId)` Sets the tint list color resource for the icon shown for this button. | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setInsetBottom(int)(int insetBottom)` Sets the button bottom inset | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setInsetLeft(int)(int insetLeft)` Sets the button left inset. | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setInsetRight(int)(int insetRight)` Sets the button right inset. | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setInsetTop(int)(int insetTop)` Sets the button top inset | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setOpticalCenterEnabled(boolean)(boolean opticalCenterEnabled)` Sets whether to enable the optical center feature. | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setPressed(boolean)(boolean pressed)` | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setRippleColor(ColorStateList)(ColorStateList rippleColor)` Sets the ripple color for this button. | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setRippleColorResource(int)(int rippleColorResourceId)` Sets the ripple color resource for this button. | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setSecondaryIcon(Drawable)(Drawable icon)` Sets the secondary icon to show for this button. | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setSecondaryIconGravity(int)( @https://developer.android.com/reference/com/google/android/material/button/MaterialButton.IconGravity int secondaryIconGravity )` Sets the secondary icon's gravity for this button. | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setSecondaryIconResource(int)(int iconResourceId)` Sets the secondary icon to show for this button. | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setSecondaryIconTint(ColorStateList)(ColorStateList secondaryIconTint)` Sets the tint list for the secondary icon shown for this button. | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setSecondaryIconTintMode(Mode)(Mode secondaryIconTintMode)` Sets the tint mode for the secondary icon shown for this button. | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setSecondaryIconTintResource(int)(int iconTintResourceId)` Sets the tint list color resource for the secondsary icon shown for this button. | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setShapeAppearanceModel(com.google.android.material.shape.ShapeAppearanceModel)(https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel shapeAppearanceModel)` Sets the `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` used for this `https://developer.android.com/reference/com/google/android/material/button/MaterialButton`'s original drawables. | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setStrokeColor(ColorStateList)(ColorStateList strokeColor)` Sets the stroke color for this button. | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setStrokeColorResource(int)(int strokeColorResourceId)` Sets the stroke color resource for this button. | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setStrokeWidth(int)(int strokeWidth)` Sets the stroke width for this button. | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setStrokeWidthResource(int)(int strokeWidthResourceId)` Sets the stroke width dimension resource for this button. | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setTextAlignment(int)(int textAlignment)` | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setTextAppearance(Context,int)(Context context, int resId)` | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setTextSize(int,float)(int unit, float size)` | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setToggleCheckedStateOnClick(boolean)(boolean toggleCheckedStateOnClick)` Sets whether or not to toggle the button checked state on click. | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setWidth(int)(int pixels)` | | `void` | `https://developer.android.com/reference/com/google/android/material/button/MaterialButton#toggle()()` | |

## Public fields

### behavior

```
public final Behavior<ExtendedFloatingActionButton> behavior
```

### collapsedSize

```
public int collapsedSize
```

### isExtended

```
public boolean isExtended
```

## Protected fields

### originalTextCsl

```
protected ColorStateList originalTextCsl
```

## Public constructors

### ExtendedFloatingActionButton

```
public ExtendedFloatingActionButton(Context context)
```

### ExtendedFloatingActionButton

```
public ExtendedFloatingActionButton(Context context, AttributeSet attrs)
```

### ExtendedFloatingActionButton

```
public ExtendedFloatingActionButton(
    Context context,
    AttributeSet attrs,
    int defStyleAttr
)
```

## Public methods

### addOnExtendAnimationListener

```
public void addOnExtendAnimationListener(AnimatorListener listener)
```

Add a listener that will be invoked when this ExtendedFloatingActionButton is extended. See AnimatorListener.

Components that add a listener should take care to remove it when finished via `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#removeOnExtendAnimationListener(AnimatorListener)`.

| Parameters |
|---|---|
| `AnimatorListener listener` | listener to add |

### addOnHideAnimationListener

```
public void addOnHideAnimationListener(AnimatorListener listener)
```

Add a listener that will be invoked when this ExtendedFloatingActionButton is hidden. See AnimatorListener.

Components that add a listener should take care to remove it when finished via `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#removeOnHideAnimationListener(AnimatorListener)`.

| Parameters |
|---|---|
| `AnimatorListener listener` | listener to add |

### addOnShowAnimationListener

```
public void addOnShowAnimationListener(AnimatorListener listener)
```

Add a listener that will be invoked when this ExtendedFloatingActionButton is shown. See AnimatorListener.

Components that add a listener should take care to remove it when finished via `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#removeOnShowAnimationListener(AnimatorListener)`.

| Parameters |
|---|---|
| `AnimatorListener listener` | listener to add |

### addOnShrinkAnimationListener

```
public void addOnShrinkAnimationListener(AnimatorListener listener)
```

Add a listener that will be invoked when this ExtendedFloatingActionButton is shrunk. See AnimatorListener.

Components that add a listener should take care to remove it when finished via `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#removeOnShrinkAnimationListener(AnimatorListener)`.

| Parameters |
|---|---|
| `AnimatorListener listener` | listener to add |

### extend

```
public void extend()
```

Extends the FAB to show the text and the icon.

This method will not affect an extended FAB which holds just text and no icon. Also, this method will animate the button show if the view has already been laid out.

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#extend(com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.OnChangedCallback)` |   |

### extend

```
public void extend(ExtendedFloatingActionButton.OnChangedCallback callback)
```

Extends the FAB to show the text and the icon.

This method will not affect an extended FAB which holds just text and no icon. Also, this method will animate the button show if the view has already been laid out.

| Parameters |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton.OnChangedCallback callback` | the callback to notify when the FAB is extended |

### getAccessibilityClassName

```
public CharSequence getAccessibilityClassName()
```

### getBehavior

```
public Behavior<ExtendedFloatingActionButton> getBehavior()
```

### getCollapsedSize

```
public int getCollapsedSize()
```

Shrink to the smaller value between paddingStart and paddingEnd, such that when shrunk the icon will be centered.

### getExtendMotionSpec

```
public MotionSpec getExtendMotionSpec()
```

Returns the motion spec for the extend animation.

### getHideMotionSpec

```
public MotionSpec getHideMotionSpec()
```

Returns the motion spec for the hide animation.

### getShowMotionSpec

```
public MotionSpec getShowMotionSpec()
```

Returns the motion spec for the show animation.

### getShrinkMotionSpec

```
public MotionSpec getShrinkMotionSpec()
```

Returns the motion spec for the shrink animation.

### 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(ExtendedFloatingActionButton.OnChangedCallback callback)
```

Hides the button.

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

| Parameters |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton.OnChangedCallback callback` | the callback to notify when this view is hidden |

### isAnimationEnabled

```
public boolean isAnimationEnabled()
```

Return whether or not animations are enabled.

### isExtended

```
public final boolean isExtended()
```

### removeOnExtendAnimationListener

```
public void removeOnExtendAnimationListener(AnimatorListener listener)
```

Remove a listener that was previously added via `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#addOnExtendAnimationListener(AnimatorListener)`.

| Parameters |
|---|---|
| `AnimatorListener listener` | listener to remove |

### removeOnHideAnimationListener

```
public void removeOnHideAnimationListener(AnimatorListener listener)
```

Remove a listener that was previously added via `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#addOnHideAnimationListener(AnimatorListener)`.

| Parameters |
|---|---|
| `AnimatorListener listener` | listener to remove |

### removeOnShowAnimationListener

```
public void removeOnShowAnimationListener(AnimatorListener listener)
```

Remove a listener that was previously added via `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#addOnShowAnimationListener(AnimatorListener)`.

| Parameters |
|---|---|
| `AnimatorListener listener` | listener to remove |

### removeOnShrinkAnimationListener

```
public void removeOnShrinkAnimationListener(AnimatorListener listener)
```

Remove a listener that was previously added via `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#addOnShrinkAnimationListener(AnimatorListener)`.

| Parameters |
|---|---|
| `AnimatorListener listener` | listener to remove |

### setAnimateShowBeforeLayout

```
public void setAnimateShowBeforeLayout(boolean animateShowBeforeLayout)
```

Sets whether to enable animation for a call to show show even if the view has not been laid out yet.

This may be set to `true` if the button is initially hidden but should animate when later shown. The default is `false`.

### setAnimationEnabled

```
public void setAnimationEnabled(boolean animationEnabled)
```

Set whether or not animations are enabled.

### setClickable

```
public void setClickable(boolean clickable)
```

Sets the clickable state of this view.

On API 26 (Android O) and above, if the view is not clickable, this method also clears the tooltip text to prevent the view from consuming touch events.

### setCollapsedSize

```
public void setCollapsedSize(int collapsedSize)
```

### setContentDescription

```
public void setContentDescription(CharSequence contentDescription)
```

Sets the content description for this view.

On API 26 (Android O) and above, this method also sets the tooltip text to the content description if appropriate.

### setExtendMotionSpec

```
public void setExtendMotionSpec(MotionSpec spec)
```

Updates the motion spec for the extend animation.

ref com.google.android.material.R.styleable#ExtendedFloatingActionButton_extendMotionSpec

### setExtendMotionSpecResource

```
public void setExtendMotionSpecResource(int id)
```

Updates the motion spec for the extend animation.

ref com.google.android.material.R.styleable#ExtendedFloatingActionButton_extendMotionSpec

### setExtended

```
public void setExtended(boolean extended)
```

Extends or shrinks the fab depending on the value of {@param extended}.

### setHideMotionSpec

```
public void setHideMotionSpec(MotionSpec spec)
```

Updates the motion spec for the hide animation.

ref com.google.android.material.R.styleable#ExtendedFloatingActionButton_hideMotionSpec

### setHideMotionSpecResource

```
public void setHideMotionSpecResource(int id)
```

Updates the motion spec for the hide animation.

ref com.google.android.material.R.styleable#ExtendedFloatingActionButton_hideMotionSpec

### setPadding

```
public void setPadding(int left, int top, int right, int bottom)
```

### setPaddingRelative

```
public void setPaddingRelative(int start, int top, int end, int bottom)
```

### setShowMotionSpec

```
public void setShowMotionSpec(MotionSpec spec)
```

Updates the motion spec for the show animation.

ref com.google.android.material.R.styleable#ExtendedFloatingActionButton_showMotionSpec

### setShowMotionSpecResource

```
public void setShowMotionSpecResource(int id)
```

Updates the motion spec for the show animation.

ref com.google.android.material.R.styleable#ExtendedFloatingActionButton_showMotionSpec

### setShrinkMotionSpec

```
public void setShrinkMotionSpec(MotionSpec spec)
```

Updates the motion spec for the shrink animation.

ref com.google.android.material.R.styleable#ExtendedFloatingActionButton_shrinkMotionSpec

### setShrinkMotionSpecResource

```
public void setShrinkMotionSpecResource(int id)
```

Updates the motion spec for the shrink animation.

ref com.google.android.material.R.styleable#ExtendedFloatingActionButton_shrinkMotionSpec

### setText

```
public void setText(CharSequence text, BufferType type)
```

Sets the text to be displayed.

On API 26 (Android O) and above, this method also sets the tooltip text if appropriate.

### setTextColor

```
public void setTextColor(int color)
```

### setTextColor

```
public void setTextColor(ColorStateList colors)
```

### show

```
public void show()
```

Shows the button.

This method will animate the button show if the view has already been laid out, or if `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#setAnimateShowBeforeLayout(boolean)` is `true`.

### show

```
public void show(ExtendedFloatingActionButton.OnChangedCallback callback)
```

Shows the button.

This method will animate the button show if the view has already been laid out, or if `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#setAnimateShowBeforeLayout(boolean)` is `true`.

| Parameters |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton.OnChangedCallback callback` | the callback to notify when this view is shown |

### shrink

```
public void shrink()
```

Shrinks the FAB to show just the icon.

This method will not affect an extended FAB which holds just text and no icon. Also, this method will animate the button show if the view has already been laid out.

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton#shrink(com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.OnChangedCallback)` |   |

### shrink

```
public void shrink(ExtendedFloatingActionButton.OnChangedCallback callback)
```

Shrinks the FAB to show just the icon.

This method will not affect an extended FAB which holds just text and no icon. Also, this method will animate the button show if the view has already been laid out.

| Parameters |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton.OnChangedCallback callback` | the callback to notify when the FAB shrank |

## Protected methods

### onAttachedToWindow

```
protected void onAttachedToWindow()
```

### silentlyUpdateTextColor

```
protected void silentlyUpdateTextColor(ColorStateList csl)
```

Update the text color without affecting the original, client-set color.