public class AppBarLayout.Behavior extends AppBarLayout.BaseBehavior

The default Behavior for AppBarLayout. Implements the necessary nested scroll handling with offsetting.

Summary

Protected methods

void

layoutChild(CoordinatorLayout parent, V child, int layoutDirection)

Inherited methods

From com.google.android.material.appbar.AppBarLayout.BaseBehavior
boolean

onLayoutChild(CoordinatorLayout parent, T abl, int layoutDirection)

boolean

onMeasureChild(
    CoordinatorLayout parent,
    T child,
    int parentWidthMeasureSpec,
    int widthUsed,
    int parentHeightMeasureSpec,
    int heightUsed
)

void

onNestedPreScroll(
    CoordinatorLayout coordinatorLayout,
    T child,
    View target,
    int dx,
    int dy,
    int[] consumed,
    int type
)

void

onNestedScroll(
    CoordinatorLayout coordinatorLayout,
    T child,
    View target,
    int dxConsumed,
    int dyConsumed,
    int dxUnconsumed,
    int dyUnconsumed,
    int type,
    int[] consumed
)

void

onRestoreInstanceState(
    CoordinatorLayout parent,
    T appBarLayout,
    Parcelable state
)

Parcelable

onSaveInstanceState(CoordinatorLayout parent, T abl)

boolean

onStartNestedScroll(
    CoordinatorLayout parent,
    T child,
    View directTargetChild,
    View target,
    int nestedScrollAxes,
    int type
)

void

onStopNestedScroll(
    CoordinatorLayout coordinatorLayout,
    T abl,
    View target,
    int type
)

void

Set a callback to control any AppBarLayout dragging.

Public constructors

Behavior

public Behavior(Context context, AttributeSet attrs)

Public methods

onInterceptTouchEvent

public boolean onInterceptTouchEvent(CoordinatorLayout parent, V child, MotionEvent ev)

onLayoutChild

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

onTouchEvent

public boolean onTouchEvent(CoordinatorLayout parent, V child, MotionEvent ev)

Protected methods

layoutChild

protected void layoutChild(CoordinatorLayout parent, V child, int layoutDirection)

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 2025-10-28 UTC.