# HideBottomViewOnScrollBehavior

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

*** ** * ** ***


```
public class HideBottomViewOnScrollBehavior<V extends View>
```

<br />

Known direct subclasses [BottomAppBar.Behavior](https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar.Behavior)

|---|---|
| `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar.Behavior` | Behavior designed for use with `https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar` instances. |

*** ** * ** ***

> [!CAUTION]
> **This class is deprecated.**   
>
> Use `https://developer.android.com/reference/com/google/android/material/behavior/HideViewOnScrollBehavior` instead.
>
> TODO(b/378132394): Migrate usages of this class to `https://developer.android.com/reference/com/google/android/material/behavior/HideViewOnScrollBehavior`.

The Behavior for a View within a CoordinatorLayout to hide the view off the bottom of the screen when scrolling down, and show it when scrolling up.

If Touch Exploration is enabled, the hide on scroll behavior should be disabled until Touch Exploration is disabled. Ensure that the content is not obscured due to disabling this behavior by adding padding to the content.

## Summary

| ### Nested types |
|---|
| `public interface https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior.OnScrollStateChangedListener` Interface definition for a listener to be notified when the bottom view scroll state changes. |

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#STATE_SCROLLED_DOWN() = 1` State of the bottom view when it's scrolled down. |
| `static final int` | `https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#STATE_SCROLLED_UP() = 2` State of the bottom view when it's scrolled up. |

| ### Public constructors |
|---|
| `[HideBottomViewOnScrollBehavior](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#HideBottomViewOnScrollBehavior())()` |
| `[HideBottomViewOnScrollBehavior](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#HideBottomViewOnScrollBehavior(Context,AttributeSet))(Context context, AttributeSet attrs)` |

| ### Public methods |
|---|---|
| `void` | `[addOnScrollStateChangedListener](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#addOnScrollStateChangedListener(com.google.android.material.behavior.HideBottomViewOnScrollBehavior.OnScrollStateChangedListener))( https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior.OnScrollStateChangedListener listener )` Adds a listener to be notified of bottom view scroll state changes. |
| `void` | `[clearOnScrollStateChangedListeners](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#clearOnScrollStateChangedListeners())()` Remove all previously added `https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior.OnScrollStateChangedListener`s. |
| `void` | `[disableOnTouchExploration](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#disableOnTouchExploration(boolean))(boolean disableOnTouchExploration)` Sets whether or not to disable this behavior if touch exploration is enabled. |
| `boolean` | `[isDisabledOnTouchExploration](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#isDisabledOnTouchExploration())()` Returns whether or not this behavior is disabled if touch exploration is enabled. |
| `boolean` | `[isScrolledDown](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#isScrolledDown())()` Returns true if the current state is scrolled down. |
| `boolean` | `[isScrolledUp](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#isScrolledUp())()` Returns true if the current state is scrolled up. |
| `boolean` | `[onLayoutChild](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#onLayoutChild(CoordinatorLayout,V,int))(CoordinatorLayout parent, V child, int layoutDirection)` |
| `void` | `[onNestedScroll](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#onNestedScroll(CoordinatorLayout,V,View,int,int,int,int,int,int[]))( CoordinatorLayout coordinatorLayout, V child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int type, int[] consumed )` |
| `boolean` | `[onStartNestedScroll](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#onStartNestedScroll(CoordinatorLayout,V,View,View,int,int))( CoordinatorLayout coordinatorLayout, V child, View directTargetChild, View target, int nestedScrollAxes, int type )` |
| `void` | `[removeOnScrollStateChangedListener](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#removeOnScrollStateChangedListener(com.google.android.material.behavior.HideBottomViewOnScrollBehavior.OnScrollStateChangedListener))( https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior.OnScrollStateChangedListener listener )` Removes a previously added listener. |
| `void` | `[setAdditionalHiddenOffsetY](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#setAdditionalHiddenOffsetY(V,int))(V child, int offset)` Sets an additional offset for the y position used to hide the view. |
| `void` | `[slideDown](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#slideDown(V))(V child)` Performs an animation that will slide the child from it's current position to be totally off the screen. |
| `void` | `[slideDown](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#slideDown(V,boolean))(V child, boolean animate)` Slides the child with or without animation from its current position to be totally off the screen. |
| `void` | `[slideUp](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#slideUp(V))(V child)` Performs an animation that will slide the child from it's current position to be totally on the screen. |
| `void` | `[slideUp](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#slideUp(V,boolean))(V child, boolean animate)` Slides the child with or without animation from its current position to be totally on the screen. |

## Constants

### STATE_SCROLLED_DOWN

```
public static final int STATE_SCROLLED_DOWN = 1
```

State of the bottom view when it's scrolled down.

### STATE_SCROLLED_UP

```
public static final int STATE_SCROLLED_UP = 2
```

State of the bottom view when it's scrolled up.

## Public constructors

### HideBottomViewOnScrollBehavior

```
public [HideBottomViewOnScrollBehavior](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#HideBottomViewOnScrollBehavior())()
```

### HideBottomViewOnScrollBehavior

```
public [HideBottomViewOnScrollBehavior](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#HideBottomViewOnScrollBehavior(Context,AttributeSet))(Context context, AttributeSet attrs)
```

## Public methods

### addOnScrollStateChangedListener

```
public void [addOnScrollStateChangedListener](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#addOnScrollStateChangedListener(com.google.android.material.behavior.HideBottomViewOnScrollBehavior.OnScrollStateChangedListener))(
    HideBottomViewOnScrollBehavior.OnScrollStateChangedListener listener
)
```

Adds a listener to be notified of bottom view scroll state changes.

| Parameters |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior.OnScrollStateChangedListener listener` | The listener to notify when bottom view scroll state changes. |

### clearOnScrollStateChangedListeners

```
public void [clearOnScrollStateChangedListeners](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#clearOnScrollStateChangedListeners())()
```

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

### disableOnTouchExploration

```
public void [disableOnTouchExploration](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#disableOnTouchExploration(boolean))(boolean disableOnTouchExploration)
```

Sets whether or not to disable this behavior if touch exploration is enabled.

### isDisabledOnTouchExploration

```
public boolean [isDisabledOnTouchExploration](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#isDisabledOnTouchExploration())()
```

Returns whether or not this behavior is disabled if touch exploration is enabled.

### isScrolledDown

```
public boolean [isScrolledDown](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#isScrolledDown())()
```

Returns true if the current state is scrolled down.

### isScrolledUp

```
public boolean [isScrolledUp](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#isScrolledUp())()
```

Returns true if the current state is scrolled up.

### onLayoutChild

```
public boolean [onLayoutChild](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#onLayoutChild(CoordinatorLayout,V,int))(CoordinatorLayout parent, V child, int layoutDirection)
```

### onNestedScroll

```
public void [onNestedScroll](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#onNestedScroll(CoordinatorLayout,V,View,int,int,int,int,int,int[]))(
    CoordinatorLayout coordinatorLayout,
    V child,
    View target,
    int dxConsumed,
    int dyConsumed,
    int dxUnconsumed,
    int dyUnconsumed,
    int type,
    int[] consumed
)
```

### onStartNestedScroll

```
public boolean [onStartNestedScroll](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#onStartNestedScroll(CoordinatorLayout,V,View,View,int,int))(
    CoordinatorLayout coordinatorLayout,
    V child,
    View directTargetChild,
    View target,
    int nestedScrollAxes,
    int type
)
```

### removeOnScrollStateChangedListener

```
public void [removeOnScrollStateChangedListener](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#removeOnScrollStateChangedListener(com.google.android.material.behavior.HideBottomViewOnScrollBehavior.OnScrollStateChangedListener))(
    HideBottomViewOnScrollBehavior.OnScrollStateChangedListener listener
)
```

Removes a previously added listener.

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

### setAdditionalHiddenOffsetY

```
public void [setAdditionalHiddenOffsetY](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#setAdditionalHiddenOffsetY(V,int))(V child, int offset)
```

Sets an additional offset for the y position used to hide the view.

| Parameters |
|---|---|
| `V child` | the child view that is hidden by this behavior |
| `int offset` | the additional offset in pixels that should be added when the view slides away |

### slideDown

```
public void [slideDown](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#slideDown(V))(V child)
```

Performs an animation that will slide the child from it's current position to be totally off the screen.

### slideDown

```
public void [slideDown](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#slideDown(V,boolean))(V child, boolean animate)
```

Slides the child with or without animation from its current position to be totally off the screen.

| Parameters |
|---|---|
| `boolean animate` | `true` to slide with animation. |

### slideUp

```
public void [slideUp](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#slideUp(V))(V child)
```

Performs an animation that will slide the child from it's current position to be totally on the screen.

### slideUp

```
public void [slideUp](https://developer.android.com/reference/com/google/android/material/behavior/HideBottomViewOnScrollBehavior#slideUp(V,boolean))(V child, boolean animate)
```

Slides the child with or without animation from its current position to be totally on the screen.

| Parameters |
|---|---|
| `boolean animate` | `true` to slide with animation. |