Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

DrawerListener

interface DrawerListener
androidx.drawerlayout.widget.DrawerLayout.DrawerListener

Listener for monitoring events about drawers.

Summary

Public methods
abstract Unit

Called when the drawer motion state changes.

abstract Unit
onDrawerSlide(@NonNull drawerView: View, slideOffset: Float)

Called when a drawer's position changes.

abstract Unit
onDrawerClosed(@NonNull drawerView: View)

Called when a drawer has settled in a completely closed state.

abstract Unit
onDrawerOpened(@NonNull drawerView: View)

Called when a drawer has settled in a completely open state.

Public methods

onDrawerStateChanged

abstract fun onDrawerStateChanged(newState: Int): Unit

Called when the drawer motion state changes. The new state will be one of STATE_IDLE, STATE_DRAGGING or STATE_SETTLING.

Parameters
newState Int: The new drawer motion state

onDrawerSlide

abstract fun onDrawerSlide(@NonNull drawerView: View, slideOffset: Float): Unit

Called when a drawer's position changes.

Parameters
drawerView View: The child view that was moved
slideOffset View: The new offset of this drawer within its range, from 0-1

onDrawerClosed

abstract fun onDrawerClosed(@NonNull drawerView: View): Unit

Called when a drawer has settled in a completely closed state.

Parameters
drawerView View: Drawer view that is now closed

onDrawerOpened

abstract fun onDrawerOpened(@NonNull drawerView: View): Unit

Called when a drawer has settled in a completely open state. The drawer is interactive at this point.

Parameters
drawerView View: Drawer view that is now open