# BottomAppBar

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

*** ** * ** ***


```
public class BottomAppBar
```

<br />

*** ** * ** ***

The Bottom App Bar is an extension of Toolbar that supports a shaped background that "cradles" an attached `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/FloatingActionButton`. A FAB is anchored to `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar` by calling setAnchorId, or by setting `app:layout_anchor` on the FAB in xml.

Note: The Material Design Guidelines caution against using an `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton` with a `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar`, so there is limited support for that use case. `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/ExtendedFloatingActionButton` can be anchored to the `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar`, but currently animations and the cutout are not supported.

There are two modes which determine where the FAB is shown relative to the `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar`. `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#FAB_ALIGNMENT_MODE_CENTER()` mode is the primary mode with the FAB is centered. `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#FAB_ALIGNMENT_MODE_END()` is the secondary mode with the FAB on the side.

Do not use the `android:background` attribute or call `BottomAppBar.setBackground` because the BottomAppBar manages its background internally. Instead use `
app:backgroundTint`.

To enable color theming for menu items you will also need to set the `
materialThemeOverlay` attribute to a ThemeOverlay which sets the `colorControlNormal` attribute to the correct color. For example, if the background of the BottomAppBar is `
colorSurface`, as it is in the default style, you should set `materialThemeOverlay` to `@style/ThemeOverlay.MaterialComponents.BottomAppBar.Surface`.

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

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

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

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

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

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

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

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

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

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

## Summary

| ### Nested types |
|---|
| `public class https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar.Behavior extends https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior` Behavior designed for use with `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar` instances. |
| `@https://developer.android.com/reference/java/lang/annotation/Retention(value = https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.SOURCE) public annotation https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar.FabAlignmentMode` The fabAlignmentMode determines the horizontal positioning of the cradle and the FAB which can be centered or aligned to the end. |
| `@https://developer.android.com/reference/java/lang/annotation/Retention(value = https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.SOURCE) public annotation https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar.FabAnimationMode` The fabAnimationMode determines the animation used to move the FAB between different alignment modes. |

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#FAB_ALIGNMENT_MODE_CENTER() = 0` |
| `static final int` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#FAB_ALIGNMENT_MODE_END() = 1` |
| `static final int` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#FAB_ANCHOR_MODE_CRADLE() = 1` The FAB is cradled at the top of the BottomAppBar. |
| `static final int` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#FAB_ANCHOR_MODE_EMBED() = 0` The FAB is embedded inside the BottomAppBar. |
| `static final int` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#FAB_ANIMATION_MODE_SCALE() = 0` |
| `static final int` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#FAB_ANIMATION_MODE_SLIDE() = 1` |
| `static final int` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#MENU_ALIGNMENT_MODE_AUTO() = 0` The menu items are aligned automatically to avoid the FAB. |
| `static final int` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#MENU_ALIGNMENT_MODE_START() = 1` The menu items are aligned to the start. |

| ### Public fields |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar.Behavior` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#behavior()` |
| `int` | `@https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar.FabAlignmentMode https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#fabAlignmentMode()` |
| `int` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#fabAlignmentModeEndMargin()` |
| `int` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#fabAnchorMode()` |
| `int` | `@https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar.FabAnimationMode https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#fabAnimationMode()` |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#hideOnScroll()` |
| `int` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#menuAlignmentMode()` |

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

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#addOnScrollStateChangedListener(com.google.android.material.behavior.HideBottomViewOnScrollBehavior.OnScrollStateChangedListener)( https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior.OnScrollStateChangedListener listener )` Add a listener that will be called when the bottom app bar scroll state changes. |
| `void` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#clearOnScrollStateChangedListeners()()` Remove all previously added `https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior.OnScrollStateChangedListener`s. |
| `ColorStateList` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#getBackgroundTint()()` |
| `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar.Behavior` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#getBehavior()()` |
| `float` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#getCradleVerticalOffset()()` Returns the vertical offset for the fab cutout. |
| `int` | `@https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar.FabAlignmentMode https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#getFabAlignmentMode()()` Returns the current fabAlignmentMode, either `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#FAB_ALIGNMENT_MODE_CENTER()` or `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#FAB_ALIGNMENT_MODE_END()`. |
| `int` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#getFabAlignmentModeEndMargin()()` Returns the `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/FloatingActionButton` end margin pixel offset for the fab if it is set. |
| `int` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#getFabAnchorMode()()` Returns the current `fabAnchorMode`, either `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#FAB_ANCHOR_MODE_CRADLE()` or `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#FAB_ANCHOR_MODE_EMBED()`. |
| `int` | `@https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar.FabAnimationMode https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#getFabAnimationMode()()` Returns the current `fabAnimationMode`, either `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#FAB_ANIMATION_MODE_SCALE()` or `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#FAB_ANIMATION_MODE_SLIDE()`. |
| `float` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#getFabCradleMargin()()` Returns the cradle margin for the fab cutout. |
| `float` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#getFabCradleRoundedCornerRadius()()` Returns the rounded corner radius for the cutout if it exists. |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#getHideOnScroll()()` Returns true if the `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar` should hide when a androidx.core.view.NestedScrollingChild is scrolled. |
| `int` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#getMenuAlignmentMode()()` Returns the current menuAlignmentMode, either `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#MENU_ALIGNMENT_MODE_AUTO()` or `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#MENU_ALIGNMENT_MODE_START()`. |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#isScrolledDown()()` Returns true if the `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar` is scrolled down. |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#isScrolledUp()()` Returns true if the `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar` is scrolled up. |
| `void` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#performHide()()` Animates the `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar` so it hides off the screen. |
| `void` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#performHide(boolean)(boolean animate)` Hides the `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar`. |
| `void` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#performShow()()` Animates the `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar` so it is shown on the screen. |
| `void` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#performShow(boolean)(boolean animate)` Shows the `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar`. |
| `void` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#removeOnScrollStateChangedListener(com.google.android.material.behavior.HideBottomViewOnScrollBehavior.OnScrollStateChangedListener)( https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior.OnScrollStateChangedListener listener )` Remove a listener that was previously added via `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#addOnScrollStateChangedListener(com.google.android.material.behavior.HideBottomViewOnScrollBehavior.OnScrollStateChangedListener)`. |
| `void` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#replaceMenu(int)(int newMenu)` A convenience method to replace the contents of the BottomAppBar's menu. |
| `void` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#setBackgroundTint(ColorStateList)(ColorStateList backgroundTint)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#setCradleVerticalOffset(float)(float verticalOffset)` Sets the vertical offset, in pixels, of the `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/FloatingActionButton` being cradled. |
| `void` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#setElevation(float)(float elevation)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#setFabAlignmentMode(int)(@https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar.FabAlignmentMode int fabAlignmentMode)` Sets the current `fabAlignmentMode`. |
| `void` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#setFabAlignmentModeAndReplaceMenu(int,int)( @https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar.FabAlignmentMode int fabAlignmentMode, int newMenu )` Sets the current `fabAlignmentMode` and replaces the `BottomAppBar`'s menu resource. |
| `void` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#setFabAlignmentModeEndMargin(int)(int margin)` Sets the end margin, in pixels, of the `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/FloatingActionButton`. |
| `void` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#setFabAnchorMode(int)(int fabAnchorMode)` Sets the current `fabAnchorMode`. |
| `void` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#setFabAnimationMode(int)(@https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar.FabAnimationMode int fabAnimationMode)` Sets the current `fabAnimationMode`. |
| `void` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#setFabCradleMargin(float)(float cradleMargin)` Sets the cradle margin for the fab cutout. |
| `void` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#setFabCradleRoundedCornerRadius(float)(float roundedCornerRadius)` Sets the rounded corner radius for the fab cutout. |
| `void` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#setHideOnScroll(boolean)(boolean hide)` Sets if the `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar` should hide when a androidx.core.view.NestedScrollingChild is scrolled. |
| `void` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#setMenuAlignmentMode(int)(int menuAlignmentMode)` Sets the current `menuAlignmentMode`. |
| `void` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#setNavigationIcon(Drawable)(Drawable drawable)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#setNavigationIconTint(int)(int navigationIconTint)` Sets the color of the toolbar's navigation icon. |
| `void` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#setSubtitle(java.lang.CharSequence)(https://developer.android.com/reference/java/lang/CharSequence subtitle)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#setTitle(java.lang.CharSequence)(https://developer.android.com/reference/java/lang/CharSequence title)` |

| ### Protected methods |
|---|---|
| `void` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#createFabDefaultXAnimation(int,java.util.List<Animator>)( @https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar.FabAlignmentMode int targetMode, https://developer.android.com/reference/java/util/List<Animator> animators )` Creates the default animation for moving a fab between alignment modes. |
| `int` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#getActionMenuViewTranslationX(ActionMenuView,int,boolean)( ActionMenuView actionMenuView, @https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar.FabAlignmentMode int fabAlignmentMode, boolean fabAttached )` Returns the X translation to position the ActionMenuView. |
| `void` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#onAttachedToWindow()()` |
| `void` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#onLayout(boolean,int,int,int,int)(boolean changed, int l, int t, int r, int b)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#onRestoreInstanceState(Parcelable)(Parcelable state)` |
| `Parcelable` | `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#onSaveInstanceState()()` |

## Constants

### FAB_ALIGNMENT_MODE_CENTER

```
public static final int FAB_ALIGNMENT_MODE_CENTER = 0
```

### FAB_ALIGNMENT_MODE_END

```
public static final int FAB_ALIGNMENT_MODE_END = 1
```

### FAB_ANCHOR_MODE_CRADLE

```
public static final int FAB_ANCHOR_MODE_CRADLE = 1
```

The FAB is cradled at the top of the BottomAppBar.

### FAB_ANCHOR_MODE_EMBED

```
public static final int FAB_ANCHOR_MODE_EMBED = 0
```

The FAB is embedded inside the BottomAppBar.

### FAB_ANIMATION_MODE_SCALE

```
public static final int FAB_ANIMATION_MODE_SCALE = 0
```

### FAB_ANIMATION_MODE_SLIDE

```
public static final int FAB_ANIMATION_MODE_SLIDE = 1
```

### MENU_ALIGNMENT_MODE_AUTO

```
public static final int MENU_ALIGNMENT_MODE_AUTO = 0
```

The menu items are aligned automatically to avoid the FAB.

### MENU_ALIGNMENT_MODE_START

```
public static final int MENU_ALIGNMENT_MODE_START = 1
```

The menu items are aligned to the start.

## Public fields

### behavior

```
public BottomAppBar.Behavior behavior
```

### fabAlignmentMode

```
@BottomAppBar.FabAlignmentMode
public int fabAlignmentMode
```

### fabAlignmentModeEndMargin

```
public int fabAlignmentModeEndMargin
```

### fabAnchorMode

```
public int fabAnchorMode
```

### fabAnimationMode

```
@BottomAppBar.FabAnimationMode
public int fabAnimationMode
```

### hideOnScroll

```
public boolean hideOnScroll
```

### menuAlignmentMode

```
public int menuAlignmentMode
```

## Public constructors

### BottomAppBar

```
public BottomAppBar(Context context)
```

### BottomAppBar

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

### BottomAppBar

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

## Public methods

### addOnScrollStateChangedListener

```
public void addOnScrollStateChangedListener(
    HideBottomViewOnScrollBehavior.OnScrollStateChangedListener listener
)
```

Add a listener that will be called when the bottom app bar scroll state changes. See `https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior.OnScrollStateChangedListener`.

Components that add a listener should take care to remove it when finished via `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#removeOnScrollStateChangedListener(com.google.android.material.behavior.HideBottomViewOnScrollBehavior.OnScrollStateChangedListener)`.

| Parameters |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior.OnScrollStateChangedListener listener` | listener to add |

### clearOnScrollStateChangedListeners

```
public void clearOnScrollStateChangedListeners()
```

Remove all previously added `https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior.OnScrollStateChangedListener`s.

### getBackgroundTint

```
public ColorStateList getBackgroundTint()
```

### getBehavior

```
public BottomAppBar.Behavior getBehavior()
```

### getCradleVerticalOffset

```
public float getCradleVerticalOffset()
```

Returns the vertical offset for the fab cutout. An offset of 0 indicates the vertical center of the `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/FloatingActionButton` is positioned on the top edge.

### getFabAlignmentMode

```
@BottomAppBar.FabAlignmentMode
public int getFabAlignmentMode()
```

Returns the current fabAlignmentMode, either `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#FAB_ALIGNMENT_MODE_CENTER()` or `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#FAB_ALIGNMENT_MODE_END()`.

### getFabAlignmentModeEndMargin

```
public int getFabAlignmentModeEndMargin()
```

Returns the `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/FloatingActionButton` end margin pixel offset for the fab if it is set.

An end margin of -1 indicates that the default margin will be used.

### getFabAnchorMode

```
public int getFabAnchorMode()
```

Returns the current `fabAnchorMode`, either `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#FAB_ANCHOR_MODE_CRADLE()` or `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#FAB_ANCHOR_MODE_EMBED()`.

### getFabAnimationMode

```
@BottomAppBar.FabAnimationMode
public int getFabAnimationMode()
```

Returns the current `fabAnimationMode`, either `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#FAB_ANIMATION_MODE_SCALE()` or `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#FAB_ANIMATION_MODE_SLIDE()`.

### getFabCradleMargin

```
public float getFabCradleMargin()
```

Returns the cradle margin for the fab cutout. This is the space between the fab and the cutout.

### getFabCradleRoundedCornerRadius

```
public float getFabCradleRoundedCornerRadius()
```

Returns the rounded corner radius for the cutout if it exists. A value of 0 will be a sharp edge.

### getHideOnScroll

```
public boolean getHideOnScroll()
```

Returns true if the `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar` should hide when a androidx.core.view.NestedScrollingChild is scrolled. This is handled by `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar.Behavior`.

### getMenuAlignmentMode

```
public int getMenuAlignmentMode()
```

Returns the current menuAlignmentMode, either `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#MENU_ALIGNMENT_MODE_AUTO()` or `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#MENU_ALIGNMENT_MODE_START()`.

### isScrolledDown

```
public boolean isScrolledDown()
```

Returns true if the `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar` is scrolled down.

### isScrolledUp

```
public boolean isScrolledUp()
```

Returns true if the `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar` is scrolled up.

### performHide

```
public void performHide()
```

Animates the `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar` so it hides off the screen.

### performHide

```
public void performHide(boolean animate)
```

Hides the `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar`.

| Parameters |
|---|---|
| `boolean animate` | `false` to hide the `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar` immediately without animation. |

### performShow

```
public void performShow()
```

Animates the `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar` so it is shown on the screen.

### performShow

```
public void performShow(boolean animate)
```

Shows the `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar`.

| Parameters |
|---|---|
| `boolean animate` | `false` to show the `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar` immediately without animation. |

### removeOnScrollStateChangedListener

```
public void removeOnScrollStateChangedListener(
    HideBottomViewOnScrollBehavior.OnScrollStateChangedListener listener
)
```

Remove a listener that was previously added via `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#addOnScrollStateChangedListener(com.google.android.material.behavior.HideBottomViewOnScrollBehavior.OnScrollStateChangedListener)`.

| Parameters |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior.OnScrollStateChangedListener listener` | listener to remove |

### replaceMenu

```
public void replaceMenu(int newMenu)
```

A convenience method to replace the contents of the BottomAppBar's menu.

| Parameters |
|---|---|
| `int newMenu` | the desired new menu. |

### setBackgroundTint

```
public void setBackgroundTint(ColorStateList backgroundTint)
```

### setCradleVerticalOffset

```
public void setCradleVerticalOffset(float verticalOffset)
```

Sets the vertical offset, in pixels, of the `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/FloatingActionButton` being cradled. An offset of 0 indicates the vertical center of the `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/FloatingActionButton` is positioned on the top edge. This will not be visible until there is a cradle.

### setElevation

```
public void setElevation(float elevation)
```

### setFabAlignmentMode

```
public void setFabAlignmentMode(@BottomAppBar.FabAlignmentMode int fabAlignmentMode)
```

Sets the current `fabAlignmentMode`. An animated transition between current and desired modes will be played.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar.FabAlignmentMode int fabAlignmentMode` | the desired fabAlignmentMode, either `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#FAB_ALIGNMENT_MODE_CENTER()` or `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#FAB_ALIGNMENT_MODE_END()`. |

### setFabAlignmentModeAndReplaceMenu

```
public void setFabAlignmentModeAndReplaceMenu(
    @BottomAppBar.FabAlignmentMode int fabAlignmentMode,
    int newMenu
)
```

Sets the current `fabAlignmentMode` and replaces the `BottomAppBar`'s menu resource. An animated transition between the current and desired mode will be played in coordination with a menu resource swap animation.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar.FabAlignmentMode int fabAlignmentMode` | the desired fabAlignmentMode, either `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#FAB_ALIGNMENT_MODE_CENTER()` or `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#FAB_ALIGNMENT_MODE_END()`. |
| `int newMenu` | the menu resource of a new menu to be inflated and swapped during the animation. Passing 0 for newMenu will not clear the menu but will skip all menu manipulation. If you'd like to animate the FAB's alignment and clear the menu at the same time, use ` getMenu().clear()` and `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#setFabAlignmentMode(int)`. |

### setFabAlignmentModeEndMargin

```
public void setFabAlignmentModeEndMargin(int margin)
```

Sets the end margin, in pixels, of the `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/FloatingActionButton`. This will only have an effect if the fab alignment mode is `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#FAB_ALIGNMENT_MODE_END()`.

An offset of -1 will use the default margin.

### setFabAnchorMode

```
public void setFabAnchorMode(int fabAnchorMode)
```

Sets the current `fabAnchorMode`.

| Parameters |
|---|---|
| `int fabAnchorMode` | the desired fabAnchorMode, either `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#FAB_ANCHOR_MODE_CRADLE()` or `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#FAB_ANCHOR_MODE_EMBED()`. |

### setFabAnimationMode

```
public void setFabAnimationMode(@BottomAppBar.FabAnimationMode int fabAnimationMode)
```

Sets the current `fabAnimationMode`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar.FabAnimationMode int fabAnimationMode` | the desired fabAlignmentMode, either `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#FAB_ALIGNMENT_MODE_CENTER()` or `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#FAB_ALIGNMENT_MODE_END()`. |

### setFabCradleMargin

```
public void setFabCradleMargin(float cradleMargin)
```

Sets the cradle margin for the fab cutout. This is the space between the fab and the cutout. If the fab anchor mode is not cradled, this will not be respected.

### setFabCradleRoundedCornerRadius

```
public void setFabCradleRoundedCornerRadius(float roundedCornerRadius)
```

Sets the rounded corner radius for the fab cutout. A value of 0 will be a sharp edge. This will not be visible until there is a cradle.

### setHideOnScroll

```
public void setHideOnScroll(boolean hide)
```

Sets if the `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar` should hide when a androidx.core.view.NestedScrollingChild is scrolled. This is handled by `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar.Behavior`.

### setMenuAlignmentMode

```
public void setMenuAlignmentMode(int menuAlignmentMode)
```

Sets the current `menuAlignmentMode`. Determines where the menu items in the BottomAppBar will be aligned.

| Parameters |
|---|---|
| `int menuAlignmentMode` | the desired menuAlignmentMode, either `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#MENU_ALIGNMENT_MODE_AUTO()` or `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#MENU_ALIGNMENT_MODE_START()`. |

### setNavigationIcon

```
public void setNavigationIcon(Drawable drawable)
```

### setNavigationIconTint

```
public void setNavigationIconTint(int navigationIconTint)
```

Sets the color of the toolbar's navigation icon.

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#setNavigationIcon(Drawable)` |   |

### setSubtitle

```
public void setSubtitle(CharSequence subtitle)
```

### setTitle

```
public void setTitle(CharSequence title)
```

## Protected methods

### createFabDefaultXAnimation

```
protected void createFabDefaultXAnimation(
    @BottomAppBar.FabAlignmentMode int targetMode,
    List<Animator> animators
)
```

Creates the default animation for moving a fab between alignment modes. Can be overridden by extending classes to create a custom animation. Animations that should be executed should be added to the animators list. The default animation defined here calls `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/FloatingActionButton#hide()` and `https://developer.android.com/reference/com/google/android/material/floatingactionbutton/FloatingActionButton#show()` rather than using custom animations.

### getActionMenuViewTranslationX

```
protected int getActionMenuViewTranslationX(
    ActionMenuView actionMenuView,
    @BottomAppBar.FabAlignmentMode int fabAlignmentMode,
    boolean fabAttached
)
```

Returns the X translation to position the ActionMenuView. When `fabAlignmentMode` is equal to `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#FAB_ALIGNMENT_MODE_END()` and `fabAttached` is true, the ActionMenuView will be aligned to the end of the navigation icon, otherwise the ActionMenuView is not moved.

### onAttachedToWindow

```
protected void onAttachedToWindow()
```

### onLayout

```
protected void onLayout(boolean changed, int l, int t, int r, int b)
```

### onRestoreInstanceState

```
protected void onRestoreInstanceState(Parcelable state)
```

### onSaveInstanceState

```
protected Parcelable onSaveInstanceState()
```