The Android Developer Challenge is back! Submit your idea before December 2.

HideBottomViewOnScrollBehavior

public class HideBottomViewOnScrollBehavior
extends Behavior<V extends View>

java.lang.Object
   ↳ androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior<V extends android.view.View>
     ↳ com.google.android.material.behavior.HideBottomViewOnScrollBehavior<V extends android.view.View>
Known Direct Subclasses


The CoordinatorLayout.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.

Summary

Constants

int ENTER_ANIMATION_DURATION

int EXIT_ANIMATION_DURATION

Public constructors

HideBottomViewOnScrollBehavior()
HideBottomViewOnScrollBehavior(Context context, AttributeSet attrs)

Public methods

boolean onLayoutChild(CoordinatorLayout parent, V child, int layoutDirection)
void onNestedScroll(CoordinatorLayout coordinatorLayout, V child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed)
boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout, V child, View directTargetChild, View target, int nestedScrollAxes)
void setAdditionalHiddenOffsetY(V child, int offset)

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

void slideDown(V child)

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

void slideUp(V child)

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

Inherited methods

From class androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
From class java.lang.Object

Constants

ENTER_ANIMATION_DURATION

int ENTER_ANIMATION_DURATION

Constant Value: 225 (0x000000e1)

EXIT_ANIMATION_DURATION

int EXIT_ANIMATION_DURATION

Constant Value: 175 (0x000000af)

Public constructors

HideBottomViewOnScrollBehavior

HideBottomViewOnScrollBehavior ()

HideBottomViewOnScrollBehavior

HideBottomViewOnScrollBehavior (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

Public methods

onLayoutChild

boolean onLayoutChild (CoordinatorLayout parent, 
                V child, 
                int layoutDirection)

Parameters
parent CoordinatorLayout

child V

layoutDirection int

Returns
boolean

onNestedScroll

void onNestedScroll (CoordinatorLayout coordinatorLayout, 
                V child, 
                View target, 
                int dxConsumed, 
                int dyConsumed, 
                int dxUnconsumed, 
                int dyUnconsumed)

Parameters
coordinatorLayout CoordinatorLayout

child V

target View

dxConsumed int

dyConsumed int

dxUnconsumed int

dyUnconsumed int

onStartNestedScroll

boolean onStartNestedScroll (CoordinatorLayout coordinatorLayout, 
                V child, 
                View directTargetChild, 
                View target, 
                int nestedScrollAxes)

Parameters
coordinatorLayout CoordinatorLayout

child V

directTargetChild View

target View

nestedScrollAxes int

Returns
boolean

setAdditionalHiddenOffsetY

void setAdditionalHiddenOffsetY (V child, 
                int offset)

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

Parameters
child V: the child view that is hidden by this behavior

offset int: the additional offset in pixels that should be added when the view slides away

slideDown

void slideDown (V child)

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

Parameters
child V

slideUp

void slideUp (V child)

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

Parameters
child V