# ExtendedFloatingActionButton.ExtendedFloatingActionButtonBehavior

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

*** ** * ** ***


```
protected class ExtendedFloatingActionButton.ExtendedFloatingActionButtonBehavior<T extends ExtendedFloatingActionButton>
```

<br />

*** ** * ** ***

Behavior designed for use with `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton` instances. Its main function is to move `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton` views so that any displayed `https://developer.android.com/reference/com/google/android/material/snackbar/Snackbar`s do not cover them.

## Summary

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

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton.ExtendedFloatingActionButtonBehavior#getInsetDodgeRect(CoordinatorLayout,com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton,Rect)( CoordinatorLayout parent, https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton child, Rect rect )` |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton.ExtendedFloatingActionButtonBehavior#isAutoHideEnabled()()` Returns whether the associated ExtendedFloatingActionButton automatically hides when there is not enough space to be displayed. |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton.ExtendedFloatingActionButtonBehavior#isAutoShrinkEnabled()()` Returns whether the associated ExtendedFloatingActionButton automatically shrinks when there is not enough space to be displayed. |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton.ExtendedFloatingActionButtonBehavior#onAttachedToLayoutParams(CoordinatorLayout.LayoutParams)(LayoutParams lp)` |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton.ExtendedFloatingActionButtonBehavior#onDependentViewChanged(CoordinatorLayout,com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton,View)( CoordinatorLayout parent, https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton child, View dependency )` |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton.ExtendedFloatingActionButtonBehavior#onLayoutChild(CoordinatorLayout,com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton,int)( CoordinatorLayout parent, https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton child, int layoutDirection )` |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton.ExtendedFloatingActionButtonBehavior#setAutoHideEnabled(boolean)(boolean autoHide)` Sets whether the associated ExtendedFloatingActionButton automatically hides when there is not enough space to be displayed. |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton.ExtendedFloatingActionButtonBehavior#setAutoShrinkEnabled(boolean)(boolean autoShrink)` Sets whether the associated ExtendedFloatingActionButton automatically shrink when there is not enough space to be displayed. |

| ### Protected methods |
|---|---|
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton.ExtendedFloatingActionButtonBehavior#extendOrShow(com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton)(https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton fab)` Extends the Extended FAB, in case auto-shrink is enabled, or show it in case auto-hide is enabled. |
| `void` | `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton.ExtendedFloatingActionButtonBehavior#shrinkOrHide(com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton)(https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton fab)` Shrinks the Extended FAB, in case auto-shrink is enabled, or hides it in case auto-hide is enabled. |

## Public constructors

### ExtendedFloatingActionButtonBehavior

```
public ExtendedFloatingActionButtonBehavior()
```

### ExtendedFloatingActionButtonBehavior

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

## Public methods

### getInsetDodgeRect

```
public boolean getInsetDodgeRect(
    CoordinatorLayout parent,
    ExtendedFloatingActionButton child,
    Rect rect
)
```

### isAutoHideEnabled

```
public boolean isAutoHideEnabled()
```

Returns whether the associated ExtendedFloatingActionButton automatically hides when there is not enough space to be displayed.

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

| Returns |
|---|---|
| `boolean` | true if enabled |

### isAutoShrinkEnabled

```
public boolean isAutoShrinkEnabled()
```

Returns whether the associated ExtendedFloatingActionButton automatically shrinks when there is not enough space to be displayed.

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

| Returns |
|---|---|
| `boolean` | true if enabled |

### onAttachedToLayoutParams

```
public void onAttachedToLayoutParams(LayoutParams lp)
```

### onDependentViewChanged

```
public boolean onDependentViewChanged(
    CoordinatorLayout parent,
    ExtendedFloatingActionButton child,
    View dependency
)
```

### onLayoutChild

```
public boolean onLayoutChild(
    CoordinatorLayout parent,
    ExtendedFloatingActionButton child,
    int layoutDirection
)
```

### setAutoHideEnabled

```
public void setAutoHideEnabled(boolean autoHide)
```

Sets whether the associated ExtendedFloatingActionButton automatically hides when there is not enough space to be displayed. This works with `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout` and `https://developer.android.com/reference/com/google/android/material/bottomsheet/BottomSheetBehavior`.

In case auto-shrink is enabled, it will take precedence over the auto-hide option.

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

| Parameters |
|---|---|
| `boolean autoHide` | true to enable automatic hiding |

### setAutoShrinkEnabled

```
public void setAutoShrinkEnabled(boolean autoShrink)
```

Sets whether the associated ExtendedFloatingActionButton automatically shrink when there is not enough space to be displayed. This works with `https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout` and `https://developer.android.com/reference/com/google/android/material/bottomsheet/BottomSheetBehavior`.

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

| Parameters |
|---|---|
| `boolean autoShrink` | true to enable automatic shrinking |

## Protected methods

### extendOrShow

```
protected void extendOrShow(ExtendedFloatingActionButton fab)
```

Extends the Extended FAB, in case auto-shrink is enabled, or show it in case auto-hide is enabled. The priority is given to the default extend option, and the button will be shown only when the auto-shrink is `false` and auto-hide is `true`.

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

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

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton.ExtendedFloatingActionButtonBehavior#setAutoShrinkEnabled(boolean)` |   |
| `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton.ExtendedFloatingActionButtonBehavior#setAutoHideEnabled(boolean)` |   |

### shrinkOrHide

```
protected void shrinkOrHide(ExtendedFloatingActionButton fab)
```

Shrinks the Extended FAB, in case auto-shrink is enabled, or hides it in case auto-hide is enabled. The priority is given to the default shrink option, and the button will be hidden only when the auto-shrink is `false` and auto-hide is `true`.

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

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

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton.ExtendedFloatingActionButtonBehavior#setAutoShrinkEnabled(boolean)` |   |
| `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton.ExtendedFloatingActionButtonBehavior#setAutoHideEnabled(boolean)` |   |