ActionBarDrawerToggle

constructor(activity: Activity, drawerLayout: DrawerLayout, @StringRes openDrawerContentDescRes: Int, @StringRes closeDrawerContentDescRes: Int)(source)

Construct a new ActionBarDrawerToggle.

The given Activity will be linked to the specified DrawerLayout and its Actionbar's Up button will be set to a custom drawable.

This drawable shows a Hamburger icon when drawer is closed and an arrow when drawer is open. It animates between these two states as the drawer opens.

String resources must be provided to describe the open/close drawer actions for accessibility services.

Parameters

activity

The Activity hosting the drawer. Should have an ActionBar.

drawerLayout

The DrawerLayout to link to the given Activity's ActionBar

openDrawerContentDescRes

A String resource to describe the "open drawer" action for accessibility

closeDrawerContentDescRes

A String resource to describe the "close drawer" action for accessibility


constructor(activity: Activity, drawerLayout: DrawerLayout, toolbar: Toolbar, @StringRes openDrawerContentDescRes: Int, @StringRes closeDrawerContentDescRes: Int)(source)

Construct a new ActionBarDrawerToggle with a Toolbar.

The given Activity will be linked to the specified DrawerLayout and the Toolbar's navigation icon will be set to a custom drawable. Using this constructor will set Toolbar's navigation click listener to toggle the drawer when it is clicked.

This drawable shows a Hamburger icon when drawer is closed and an arrow when drawer is open. It animates between these two states as the drawer opens.

String resources must be provided to describe the open/close drawer actions for accessibility services.

Please use ActionBarDrawerToggle if you are setting the Toolbar as the ActionBar of your activity.

Parameters

activity

The Activity hosting the drawer.

toolbar

The toolbar to use if you have an independent Toolbar.

drawerLayout

The DrawerLayout to link to the given Activity's ActionBar

openDrawerContentDescRes

A String resource to describe the "open drawer" action for accessibility

closeDrawerContentDescRes

A String resource to describe the "close drawer" action for accessibility