AppBarLayout.BaseBehavior

protected class AppBarLayout.BaseBehavior<T extends AppBarLayout>

Known direct subclasses

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

Summary

Nested types

public abstract class AppBarLayout.BaseBehavior.BaseDragCallback<T extends AppBarLayout>

Callback to allow control over any AppBarLayout dragging.

A Parcelable implementation for AppBarLayout.

Public constructors

BaseBehavior(Context context, AttributeSet attrs)

Public methods

int
int
boolean
boolean
boolean
onInterceptTouchEvent(CoordinatorLayout parent, V child, MotionEvent ev)
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
)
boolean
onTouchEvent(CoordinatorLayout parent, V child, MotionEvent ev)
void

Set a callback to control any AppBarLayout dragging.

void
setHorizontalOffsetEnabled(boolean horizontalOffsetEnabled)
boolean
boolean
void
setVerticalOffsetEnabled(boolean verticalOffsetEnabled)

Protected methods

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

Public constructors

BaseBehavior

public BaseBehavior()

BaseBehavior

public BaseBehavior(Context context, AttributeSet attrs)

Public methods

getLeftAndRightOffset

public int getLeftAndRightOffset()

getTopAndBottomOffset

public int getTopAndBottomOffset()

isHorizontalOffsetEnabled

public boolean isHorizontalOffsetEnabled()

isVerticalOffsetEnabled

public boolean isVerticalOffsetEnabled()

onInterceptTouchEvent

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

onLayoutChild

public boolean onLayoutChild(CoordinatorLayout parent, T abl, int layoutDirection)

onMeasureChild

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

onNestedPreScroll

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

onNestedScroll

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

onRestoreInstanceState

public void onRestoreInstanceState(
    CoordinatorLayout parent,
    T appBarLayout,
    Parcelable state
)

onSaveInstanceState

public Parcelable onSaveInstanceState(CoordinatorLayout parent, T abl)

onStartNestedScroll

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

onStopNestedScroll

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

onTouchEvent

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

setDragCallback

public void setDragCallback(AppBarLayout.BaseBehavior.BaseDragCallback callback)

Set a callback to control any AppBarLayout dragging.

Parameters
AppBarLayout.BaseBehavior.BaseDragCallback callback

the callback to use, or null to use the default behavior.

setHorizontalOffsetEnabled

public void setHorizontalOffsetEnabled(boolean horizontalOffsetEnabled)

setLeftAndRightOffset

public boolean setLeftAndRightOffset(int offset)

setTopAndBottomOffset

public boolean setTopAndBottomOffset(int offset)

setVerticalOffsetEnabled

public void setVerticalOffsetEnabled(boolean verticalOffsetEnabled)

Protected methods

layoutChild

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