Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.

AppBarLayout.BaseBehavior

protected static class AppBarLayout.BaseBehavior
extends

java.lang.Object
   ↳
     ↳ com.google.android.material.appbar.AppBarLayout.BaseBehavior<T extends com.google.android.material.appbar.AppBarLayout>
Known Direct Subclasses


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

Summary

Nested classes

class AppBarLayout.BaseBehavior.BaseDragCallback<T extends AppBarLayout>

Callback to allow control over any AppBarLayout dragging. 

class AppBarLayout.BaseBehavior.SavedState

 

Public constructors

AppBarLayout.BaseBehavior()
AppBarLayout.BaseBehavior(Context context, AttributeSet attrs)

Public methods

int getLeftAndRightOffset()
int getTopAndBottomOffset()
boolean onInterceptTouchEvent(CoordinatorLayout parent, V child, MotionEvent ev)
boolean onLayoutChild(CoordinatorLayout parent, V child, int layoutDirection)
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)
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 setDragCallback(BaseDragCallback callback)

Set a callback to control any AppBarLayout dragging.

boolean setLeftAndRightOffset(int offset)
boolean setTopAndBottomOffset(int offset)

Protected methods

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

Inherited methods

From class java.lang.Object

Public constructors

AppBarLayout.BaseBehavior

AppBarLayout.BaseBehavior ()

AppBarLayout.BaseBehavior

AppBarLayout.BaseBehavior (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

Public methods

getLeftAndRightOffset

int getLeftAndRightOffset ()

Returns
int

getTopAndBottomOffset

int getTopAndBottomOffset ()

Returns
int

onInterceptTouchEvent

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

Parameters
parent CoordinatorLayout

child V

ev MotionEvent

Returns
boolean

onLayoutChild

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

Parameters
parent CoordinatorLayout

child V

layoutDirection int

Returns
boolean

onLayoutChild

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

Parameters
parent CoordinatorLayout

abl T

layoutDirection int

Returns
boolean

onMeasureChild

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

Parameters
parent CoordinatorLayout

child T

parentWidthMeasureSpec int

widthUsed int

parentHeightMeasureSpec int

heightUsed int

Returns
boolean

onNestedPreScroll

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

Parameters
coordinatorLayout CoordinatorLayout

child T

target View

dx int

dy int

consumed int

type int

onNestedScroll

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

Parameters
coordinatorLayout CoordinatorLayout

child T

target View

dxConsumed int

dyConsumed int

dxUnconsumed int

dyUnconsumed int

type int

onRestoreInstanceState

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

Parameters
parent CoordinatorLayout

appBarLayout T

state Parcelable

onSaveInstanceState

Parcelable onSaveInstanceState (CoordinatorLayout parent, 
                T abl)

Parameters
parent CoordinatorLayout

abl T

Returns
Parcelable

onStartNestedScroll

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

Parameters
parent CoordinatorLayout

child T

directTargetChild View

target View

nestedScrollAxes int

type int

Returns
boolean

onStopNestedScroll

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

Parameters
coordinatorLayout CoordinatorLayout

abl T

target View

type int

onTouchEvent

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

Parameters
parent CoordinatorLayout

child V

ev MotionEvent

Returns
boolean

setDragCallback

void setDragCallback (BaseDragCallback callback)

Set a callback to control any AppBarLayout dragging.

Parameters
callback BaseDragCallback: the callback to use, or null to use the default behavior.

setLeftAndRightOffset

boolean setLeftAndRightOffset (int offset)

Parameters
offset int

Returns
boolean

setTopAndBottomOffset

boolean setTopAndBottomOffset (int offset)

Parameters
offset int

Returns
boolean

Protected methods

layoutChild

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

Parameters
parent CoordinatorLayout

child V

layoutDirection int