# DrawerActions

Summary:[Methods](https://developer.android.com/reference/android/support/test/espresso/contrib/DrawerActions#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/test/espresso/contrib/DrawerActions#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/test/espresso/contrib/DrawerActions#)  

# DrawerActions

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public

final

class
DrawerActions
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object.html)`


``


`

|---|-----------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) ||
| ↳ | android.support.test.espresso.contrib.DrawerActions |

<br />

*** ** * ** ***

Espresso actions for using a[DrawerLayout](https://developer.android.com/reference/android/support/v4/widget/DrawerLayout).  
**See also:**

- [Navigation drawer design guide](http://developer.android.com/design/patterns/navigation-drawer.html)

## Summary

|                                                                                                                                                                                                                                                    ### Public methods                                                                                                                                                                                                                                                    ||
|----------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` static `[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | ` `[close](https://developer.android.com/reference/android/support/test/espresso/contrib/DrawerActions#close(int))`(int gravity) ` Creates an action which closes the[DrawerLayout](https://developer.android.com/reference/android/support/v4/widget/DrawerLayout)with the gravity.                                                                                                                           |
| ` static `[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | ` `[close](https://developer.android.com/reference/android/support/test/espresso/contrib/DrawerActions#close())`() ` Creates an action which closes the[DrawerLayout](https://developer.android.com/reference/android/support/v4/widget/DrawerLayout)with gravity START.                                                                                                                                       |
| ` static void`                                                                                           | ` `[closeDrawer](https://developer.android.com/reference/android/support/test/espresso/contrib/DrawerActions#closeDrawer(int, int))`(int drawerLayoutId, int gravity) ` *This method is deprecated. Use[open(int)](https://developer.android.com/reference/android/support/test/espresso/contrib/DrawerActions#open(int))with`perform`after matching a view. This method will be removed in the next release.* |
| ` static void`                                                                                           | ` `[closeDrawer](https://developer.android.com/reference/android/support/test/espresso/contrib/DrawerActions#closeDrawer(int))`(int drawerLayoutId) ` *This method is deprecated. Use[close()](https://developer.android.com/reference/android/support/test/espresso/contrib/DrawerActions#close())with`perform`after matching a view. This method will be removed in the next release.*                       |
| ` static `[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | ` `[open](https://developer.android.com/reference/android/support/test/espresso/contrib/DrawerActions#open(int))`(int gravity) ` Creates an action which opens the[DrawerLayout](https://developer.android.com/reference/android/support/v4/widget/DrawerLayout)drawer with the gravity.                                                                                                                       |
| ` static `[ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | ` `[open](https://developer.android.com/reference/android/support/test/espresso/contrib/DrawerActions#open())`() ` Creates an action which opens the[DrawerLayout](https://developer.android.com/reference/android/support/v4/widget/DrawerLayout)drawer with gravity START.                                                                                                                                   |
| ` static void`                                                                                           | ` `[openDrawer](https://developer.android.com/reference/android/support/test/espresso/contrib/DrawerActions#openDrawer(int))`(int drawerLayoutId) ` *This method is deprecated. Use[open()](https://developer.android.com/reference/android/support/test/espresso/contrib/DrawerActions#open())with`perform`after matching a view. This method will be removed in the next release.*                           |
| ` static void`                                                                                           | ` `[openDrawer](https://developer.android.com/reference/android/support/test/espresso/contrib/DrawerActions#openDrawer(int, int))`(int drawerLayoutId, int gravity) ` *This method is deprecated. Use[open(int)](https://developer.android.com/reference/android/support/test/espresso/contrib/DrawerActions#open(int))with`perform`after matching a view. This method will be removed in the next release.*   |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/espresso/contrib/DrawerActions#)From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object.html)` ` |-------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object.html)          | ` clone() `                                                                                | | ` boolean`                                                                          | ` equals(`[Object](https://developer.android.com/reference/java/lang/Object.html)` arg0) ` | | ` void`                                                                             | ` finalize() `                                                                             | | ` final `[Class](https://developer.android.com/reference/java/lang/Class.html)`<?>` | ` getClass() `                                                                             | | ` int`                                                                              | ` hashCode() `                                                                             | | ` final void`                                                                       | ` notify() `                                                                               | | ` final void`                                                                       | ` notifyAll() `                                                                            | | ` `[String](https://developer.android.com/reference/java/lang/String.html)          | ` toString() `                                                                             | | ` final void`                                                                       | ` wait(long arg0, int arg1) `                                                              | | ` final void`                                                                       | ` wait(long arg0) `                                                                        | | ` final void`                                                                       | ` wait() `                                                                                 | ||

## Public methods

### close

```
ViewAction close (int gravity)
```

Creates an action which closes the[DrawerLayout](https://developer.android.com/reference/android/support/v4/widget/DrawerLayout)with the gravity. This method blocks until the drawer is fully closed. No operation if the drawer is already closed.

<br />

|       Parameters        ||
|-----------|--------------|
| `gravity` | `int` <br /> |

|                                                Returns                                                 ||
|------------------------------------------------------------------------------------------------|--------|
| [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | <br /> |

### close

```
ViewAction close ()
```

Creates an action which closes the[DrawerLayout](https://developer.android.com/reference/android/support/v4/widget/DrawerLayout)with gravity START. This method blocks until the drawer is fully closed. No operation if the drawer is already closed.

<br />

|                                                Returns                                                 ||
|------------------------------------------------------------------------------------------------|--------|
| [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | <br /> |

### closeDrawer

```
void closeDrawer (int drawerLayoutId, 
                int gravity)
```

<br />

**This method is deprecated.**   
Use[open(int)](https://developer.android.com/reference/android/support/test/espresso/contrib/DrawerActions#open(int))with`perform`after matching a view. This method will be removed in the next release.

<br />

<br />

|           Parameters           ||
|------------------|--------------|
| `drawerLayoutId` | `int` <br /> |
| `gravity`        | `int` <br /> |

### closeDrawer

```
void closeDrawer (int drawerLayoutId)
```

<br />

**This method is deprecated.**   
Use[close()](https://developer.android.com/reference/android/support/test/espresso/contrib/DrawerActions#close())with`perform`after matching a view. This method will be removed in the next release.

<br />

<br />

|           Parameters           ||
|------------------|--------------|
| `drawerLayoutId` | `int` <br /> |

### open

```
ViewAction open (int gravity)
```

Creates an action which opens the[DrawerLayout](https://developer.android.com/reference/android/support/v4/widget/DrawerLayout)drawer with the gravity. This method blocks until the drawer is fully open. No operation if the drawer is already open.

<br />

|       Parameters        ||
|-----------|--------------|
| `gravity` | `int` <br /> |

|                                                Returns                                                 ||
|------------------------------------------------------------------------------------------------|--------|
| [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | <br /> |

### open

```
ViewAction open ()
```

Creates an action which opens the[DrawerLayout](https://developer.android.com/reference/android/support/v4/widget/DrawerLayout)drawer with gravity START. This method blocks until the drawer is fully open. No operation if the drawer is already open.

<br />

|                                                Returns                                                 ||
|------------------------------------------------------------------------------------------------|--------|
| [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction) | <br /> |

### openDrawer

```
void openDrawer (int drawerLayoutId)
```

<br />

**This method is deprecated.**   
Use[open()](https://developer.android.com/reference/android/support/test/espresso/contrib/DrawerActions#open())with`perform`after matching a view. This method will be removed in the next release.

<br />

<br />

|           Parameters           ||
|------------------|--------------|
| `drawerLayoutId` | `int` <br /> |

### openDrawer

```
void openDrawer (int drawerLayoutId, 
                int gravity)
```

<br />

**This method is deprecated.**   
Use[open(int)](https://developer.android.com/reference/android/support/test/espresso/contrib/DrawerActions#open(int))with`perform`after matching a view. This method will be removed in the next release.

<br />

<br />

|           Parameters           ||
|------------------|--------------|
| `drawerLayoutId` | `int` <br /> |
| `gravity`        | `int` <br /> |

-

  ## Interfaces

  - [RecyclerViewActions.PositionableRecyclerViewAction](https://developer.android.com/reference/android/support/test/espresso/contrib/RecyclerViewActions.PositionableRecyclerViewAction)
-

  ## Classes

  - [AccessibilityChecks](https://developer.android.com/reference/android/support/test/espresso/contrib/AccessibilityChecks)
  - [ActivityResultMatchers](https://developer.android.com/reference/android/support/test/espresso/contrib/ActivityResultMatchers)
  - [DrawerActions](https://developer.android.com/reference/android/support/test/espresso/contrib/DrawerActions)
  - [DrawerMatchers](https://developer.android.com/reference/android/support/test/espresso/contrib/DrawerMatchers)
  - [NavigationViewActions](https://developer.android.com/reference/android/support/test/espresso/contrib/NavigationViewActions)
  - [PickerActions](https://developer.android.com/reference/android/support/test/espresso/contrib/PickerActions)
  - [RecyclerViewActions](https://developer.android.com/reference/android/support/test/espresso/contrib/RecyclerViewActions)
  - [ViewPagerActions](https://developer.android.com/reference/android/support/test/espresso/contrib/ViewPagerActions)