HideBottomViewOnScrollBehavior


Kotlin |Java

public class HideBottomViewOnScrollBehavior<V extends View>

Known direct subclasses
BottomAppBar.Behavior

Behavior designed for use with BottomAppBar instances.


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

Interface definition for a listener to be notified when the bottom view scroll state changes.

Constants

static final int

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

static final int

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

Public constructors

(削除) HideBottomViewOnScrollBehavior (削除ここまで)()
(削除) HideBottomViewOnScrollBehavior (削除ここまで)(Context context, AttributeSet attrs)

Public methods

void

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

void
(削除) clearOnScrollStateChangedListeners (削除ここまで)()

Remove all previously added OnScrollStateChangedListener s.

void
(削除) disableOnTouchExploration (削除ここまで)(boolean disableOnTouchExploration)

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

boolean
(削除) isDisabledOnTouchExploration (削除ここまで)()

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

boolean
(削除) isScrolledDown (削除ここまで)()

Returns true if the current state is scrolled down.

boolean
(削除) isScrolledUp (削除ここまで)()

Returns true if the current state is scrolled up.

boolean
(削除) onLayoutChild (削除ここまで)(CoordinatorLayout parent, V child, int layoutDirection)
void
(削除) onNestedScroll (削除ここまで)(
CoordinatorLayout coordinatorLayout,
V child,
View target,
int dxConsumed,
int dyConsumed,
int dxUnconsumed,
int dyUnconsumed,
int type,
int[] consumed
)
boolean
(削除) onStartNestedScroll (削除ここまで)(
CoordinatorLayout coordinatorLayout,
V child,
View directTargetChild,
View target,
int nestedScrollAxes,
int type
)
void

Removes a previously added listener.

void
(削除) setAdditionalHiddenOffsetY (削除ここまで)(V child, int offset)

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

void
(削除) slideDown (削除ここまで)(V child)

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

void
(削除) slideDown (削除ここまで)(V child, boolean animate)

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

void
(削除) slideUp (削除ここまで)(V child)

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

void
(削除) slideUp (削除ここまで)(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 (削除ここまで)()

HideBottomViewOnScrollBehavior

public (削除) HideBottomViewOnScrollBehavior (削除ここまで)(Context context, AttributeSet attrs)

Public methods

addOnScrollStateChangedListener

public void (削除) addOnScrollStateChangedListener (削除ここまで)(
HideBottomViewOnScrollBehavior.OnScrollStateChangedListener listener
)

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

Parameters
HideBottomViewOnScrollBehavior.OnScrollStateChangedListener listener

The listener to notify when bottom view scroll state changes.

clearOnScrollStateChangedListeners

public void (削除) clearOnScrollStateChangedListeners (削除ここまで)()

Remove all previously added OnScrollStateChangedListener s.

disableOnTouchExploration

public void (削除) disableOnTouchExploration (削除ここまで)(boolean disableOnTouchExploration)

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

isDisabledOnTouchExploration

public boolean (削除) isDisabledOnTouchExploration (削除ここまで)()

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

isScrolledDown

public boolean (削除) isScrolledDown (削除ここまで)()

Returns true if the current state is scrolled down.

isScrolledUp

public boolean (削除) isScrolledUp (削除ここまで)()

Returns true if the current state is scrolled up.

onLayoutChild

public boolean (削除) onLayoutChild (削除ここまで)(CoordinatorLayout parent, V child, int layoutDirection)

onNestedScroll

public void (削除) onNestedScroll (削除ここまで)(
CoordinatorLayout coordinatorLayout,
V child,
View target,
int dxConsumed,
int dyConsumed,
int dxUnconsumed,
int dyUnconsumed,
int type,
int[] consumed
)

onStartNestedScroll

public boolean (削除) onStartNestedScroll (削除ここまで)(
CoordinatorLayout coordinatorLayout,
V child,
View directTargetChild,
View target,
int nestedScrollAxes,
int type
)

removeOnScrollStateChangedListener

public void (削除) removeOnScrollStateChangedListener (削除ここまで)(
HideBottomViewOnScrollBehavior.OnScrollStateChangedListener listener
)

Removes a previously added listener.

Parameters
HideBottomViewOnScrollBehavior.OnScrollStateChangedListener listener

The listener to remove.

setAdditionalHiddenOffsetY

public void (削除) setAdditionalHiddenOffsetY (削除ここまで)(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 (削除ここまで)(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 (削除ここまで)(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 (削除ここまで)(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 (削除ここまで)(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.

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2026年05月14日 UTC.