# DrawerLayout.DrawerListener

# DrawerLayout.DrawerListener

Artifact:[androidx.drawerlayout:drawerlayout](https://developer.android.com/jetpack/androidx/releases/drawerlayout)  
[View Source](https://cs.android.com/search?q=file:androidx/drawerlayout/widget/DrawerLayout.java+class:androidx.drawerlayout.widget.DrawerLayout.DrawerListener)  
Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/drawerlayout#1.0.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/drawerlayout/widget/DrawerLayout.DrawerListener "View this page in Java")

<br />

```
interface DrawerLayout.DrawerListener
```

<br />

Known direct subclasses  
[ActionBarDrawerToggle](https://developer.android.com/reference/kotlin/androidx/appcompat/app/ActionBarDrawerToggle),[DrawerLayout.SimpleDrawerListener](https://developer.android.com/reference/kotlin/androidx/drawerlayout/widget/DrawerLayout.SimpleDrawerListener)  

|----------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ActionBarDrawerToggle](https://developer.android.com/reference/kotlin/androidx/appcompat/app/ActionBarDrawerToggle)                               | This class provides a handy way to tie together the functionality of[DrawerLayout](https://developer.android.com/reference/kotlin/androidx/drawerlayout/widget/DrawerLayout)and the framework`ActionBar`to implement the recommended design for navigation drawers. |
| [DrawerLayout.SimpleDrawerListener](https://developer.android.com/reference/kotlin/androidx/drawerlayout/widget/DrawerLayout.SimpleDrawerListener) | Stub/no-op implementations of all methods of[DrawerListener](https://developer.android.com/reference/kotlin/androidx/drawerlayout/widget/DrawerLayout.DrawerListener).                                                                                              |

*** ** * ** ***

Listener for monitoring events about drawers.

## Summary

|                             ### Public functions                              |
|-------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onDrawerClosed](https://developer.android.com/reference/kotlin/androidx/drawerlayout/widget/DrawerLayout.DrawerListener#onDrawerClosed(android.view.View))`(drawerView: `[View](https://developer.android.com/reference/android/view/View.html)`)` Called when a drawer has settled in a completely closed state.                                                                               |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onDrawerOpened](https://developer.android.com/reference/kotlin/androidx/drawerlayout/widget/DrawerLayout.DrawerListener#onDrawerOpened(android.view.View))`(drawerView: `[View](https://developer.android.com/reference/android/view/View.html)`)` Called when a drawer has settled in a completely open state.                                                                                 |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onDrawerSlide](https://developer.android.com/reference/kotlin/androidx/drawerlayout/widget/DrawerLayout.DrawerListener#onDrawerSlide(android.view.View,float))`(drawerView: `[View](https://developer.android.com/reference/android/view/View.html)`, slideOffset: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`)` Called when a drawer's position changes. |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onDrawerStateChanged](https://developer.android.com/reference/kotlin/androidx/drawerlayout/widget/DrawerLayout.DrawerListener#onDrawerStateChanged(int))`(newState: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Called when the drawer motion state changes.                                                                                                |

## Public functions

### onDrawerClosed

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/drawerlayout#1.0.0)  

```
fun onDrawerClosed(drawerView: View): Unit
```

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

|                                      Parameters                                      |
|--------------------------------------------------------------------------------------|--------------------------------|
| `drawerView: `[View](https://developer.android.com/reference/android/view/View.html) | Drawer view that is now closed |

### onDrawerOpened

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/drawerlayout#1.0.0)  

```
fun onDrawerOpened(drawerView: View): Unit
```

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

|                                      Parameters                                      |
|--------------------------------------------------------------------------------------|------------------------------|
| `drawerView: `[View](https://developer.android.com/reference/android/view/View.html) | Drawer view that is now open |

### onDrawerSlide

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/drawerlayout#1.0.0)  

```
fun onDrawerSlide(drawerView: View, slideOffset: Float): Unit
```

Called when a drawer's position changes.  

|                                           Parameters                                           |
|------------------------------------------------------------------------------------------------|----------------------------------------------------------|
| `drawerView: `[View](https://developer.android.com/reference/android/view/View.html)           | The child view that was moved                            |
| `slideOffset: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | The new offset of this drawer within its range, from 0-1 |

### onDrawerStateChanged

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/drawerlayout#1.0.0)  

```
fun onDrawerStateChanged(newState: Int): Unit
```

Called when the drawer motion state changes. The new state will be one of[STATE_IDLE](https://developer.android.com/reference/kotlin/androidx/drawerlayout/widget/DrawerLayout#STATE_IDLE()),[STATE_DRAGGING](https://developer.android.com/reference/kotlin/androidx/drawerlayout/widget/DrawerLayout#STATE_DRAGGING())or[STATE_SETTLING](https://developer.android.com/reference/kotlin/androidx/drawerlayout/widget/DrawerLayout#STATE_SETTLING()).  

|                                       Parameters                                        |
|-----------------------------------------------------------------------------------------|-----------------------------|
| `newState: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The new drawer motion state |