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 |
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 |
onConfigurationChanged(newConfig: Configuration!) This method should always be called by your |
open Unit |
onDrawerClosed(drawerView: View)
|
open Unit |
onDrawerOpened(drawerView: View)
|
open Unit |
onDrawerSlide(drawerView: View, slideOffset: Float)
|
open Unit |
onDrawerStateChanged(newState: Int)
|
open Boolean |
onOptionsItemSelected(item: MenuItem!) This method should be called by your |
open Unit |
setDrawerArrowDrawable(@NonNull drawable: DrawerArrowDrawable) Sets the DrawerArrowDrawable that should be shown by this ActionBarDrawerToggle. |
open Unit |
setDrawerIndicatorEnabled(enable: Boolean) Enable or disable the drawer indicator. |
open Unit |
setDrawerSlideAnimationEnabled(enabled: Boolean) Specifies whether the drawer arrow should animate when the drawer position changes. |
open Unit |
setHomeAsUpIndicator(indicator: Drawable!) Set the up indicator to display when the drawer indicator is not enabled. |
open Unit |
setHomeAsUpIndicator(resId: Int) Set the up indicator to display when the drawer indicator is not enabled. |
open Unit |
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: DrawerLayout!,
@StringRes openDrawerContentDescRes: Int