added in version 24.1.0
belongs to Maven artifact


public class ActionBarDrawerToggle
extends Object implements DrawerLayout.DrawerListener


This class provides a handy way to tie together the functionality of DrawerLayout and the framework ActionBar to implement the recommended design for navigation drawers.

To use ActionBarDrawerToggle, create one in your Activity and call through to the following methods corresponding to your Activity callbacks:

Call syncState() from your Activity's onPostCreate to synchronize the indicator with the state of the linked DrawerLayout after onRestoreInstanceState has occurred.

ActionBarDrawerToggle can be used directly as a DrawerLayout.DrawerListener, or if you are already providing your own listener, call through to each of the listener methods from your own.

You can customize the the animated toggle by defining the drawerArrowStyle in your ActionBar theme.


Nested classes

interface ActionBarDrawerToggle.Delegate


interface ActionBarDrawerToggle.DelegateProvider

Allows an implementing Activity to return an ActionBarDrawerToggle.Delegate to use with ActionBarDrawerToggle. 

Public constructors

ActionBarDrawerToggle(Activity activity, DrawerLayout drawerLayout, int openDrawerContentDescRes, int closeDrawerContentDescRes)

Construct a new ActionBarDrawerToggle.

ActionBarDrawerToggle(Activity activity, DrawerLayout drawerLayout, Toolbar toolbar, int openDrawerContentDescRes, int closeDrawerContentDescRes)

Construct a new ActionBarDrawerToggle with a Toolbar.

Public methods

DrawerArrowDrawable getDrawerArrowDrawable()
View.OnClickListener getToolbarNavigationClickListener()

Returns the fallback listener for Navigation icon click events.

boolean isDrawerIndicatorEnabled()
boolean isDrawerSlideAnimationEnabled()
void onConfigurationChanged(Configuration newConfig)

This method should always be called by your Activity's onConfigurationChanged method.

void onDrawerClosed(View drawerView)

DrawerLayout.DrawerListener callback method.

void onDrawerOpened(View drawerView)

DrawerLayout.DrawerListener callback method.

void onDrawerSlide(View drawerView, float slideOffset)

DrawerLayout.DrawerListener callback method.

void onDrawerStateChanged(int newState)

DrawerLayout.DrawerListener callback method.

boolean onOptionsItemSelected(MenuItem item)

This method should be called by your Activity's onOptionsItemSelected method.

void setDrawerArrowDrawable(DrawerArrowDrawable drawable)

Sets the DrawerArrowDrawable that should be shown by this ActionBarDrawerToggle.

void setDrawerIndicatorEnabled(boolean enable)

Enable or disable the drawer indicator.

void setDrawerSlideAnimationEnabled(boolean enabled)