Android 12 Developer Preview is here! Try it out, and give us your feedback!

ActionBarDrawerToggle

open class ActionBarDrawerToggle : DrawerLayout.DrawerListener
kotlin.Any
   ↳ androidx.appcompat.app.ActionBarDrawerToggle

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.

Summary

Nested classes
abstract

abstract

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

Public constructors
<init>(activity: Activity!, drawerLayout: DrawerLayout!, @StringRes openDrawerContentDescRes: Int, @StringRes closeDrawerContentDescRes: Int)

Construct a new ActionBarDrawerToggle.

<init>(activity: Activity!, drawerLayout: DrawerLayout!, toolbar: Toolbar!, @StringRes openDrawerContentDescRes: Int, @StringRes closeDrawerContentDescRes: Int)

Construct a new ActionBarDrawerToggle with a Toolbar.

Public methods
open DrawerArrowDrawable

open OnClickListener!

Returns the fallback listener for Navigation icon click events.

open Boolean

open Boolean

open Unit

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

open Unit
onDrawerClosed(drawerView: View)

DrawerLayout.DrawerListener callback method.

open Unit
onDrawerOpened(drawerView: View)

DrawerLayout.DrawerListener callback method.

open Unit
onDrawerSlide(drawerView: View, slideOffset: Float)

DrawerLayout.DrawerListener callback method.

open Unit

DrawerLayout.DrawerListener callback method.

open Boolean

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

open Unit

Sets the DrawerArrowDrawable that should be shown by this ActionBarDrawerToggle.

open Unit

Enable or disable the drawer indicator.

open Unit

Specifies whether the drawer arrow should animate when the drawer position changes.

open Unit

Set the up indicator to display when the drawer indicator is not enabled.

open Unit

Set the up indicator to display when the drawer indicator is not enabled.

open Unit
setToolbarNavigationClickListener(onToolbarNavigationClickListener: OnClickListener!)

When DrawerToggle is constructed with a Toolbar, it sets the click listener on the Navigation icon.

open Unit

Synchronize the state of the drawer indicator/affordance with the linked DrawerLayout.

Public constructors

<init>

ActionBarDrawerToggle(
    activity: Activity!,
    drawerLayout: