AppBarConfiguration


class AppBarConfiguration


Configuration options for NavigationUI methods that interact with implementations of the app bar pattern such as androidx.appcompat.widget.Toolbar, com.google.android.material.appbar.CollapsingToolbarLayout, and androidx.appcompat.app.ActionBar.

Summary

Nested types

The Builder class for constructing new AppBarConfiguration instances.

Interface for providing custom 'up' behavior beyond what is provided by androidx.navigation.NavController.navigateUp.

Public functions

Boolean

Determines whether a NavDestination is a top level destination in AppBarConfiguration.

Public properties

DrawerLayout?

The DrawerLayout indicating that the Navigation button should be displayed as a drawer symbol when it is not being shown as an Up button.

AppBarConfiguration.OnNavigateUpListener?

The OnNavigateUpListener that should be invoked if androidx.navigation.NavController.navigateUp returns false.

Openable?

The Openable layout indicating that the Navigation button should be displayed as a drawer symbol when it is not being shown as an Up button.

Set<Int>

The set of destinations by id considered at the top level of your information hierarchy.

Public functions

isTopLevelDestination

Added in 2.6.0
fun isTopLevelDestination(destination: NavDestination): Boolean

Determines whether a NavDestination is a top level destination in AppBarConfiguration.

Returns true if the NavDestination was added directly as a top level destination via AppBarConfiguration.Builder constructors such as AppBarConfiguration.Builder(topLevelDestinationIds: Set<Int>). If destination was added with a AppBarConfiguration.Builder that could take in a graph, i.e. AppBarConfiguration.Builder(NavGraph) orAppBarConfiguration.Builder(Menu), this helper will return true if the destination is the start destination of a graph (including nested graphs i.e. MenuItem that are also NavGraph), or an individual MenuItem within the Menu.

Parameters
destination: NavDestination

the NavDestination to check whether it is a topLevelDestination

Public properties

drawerLayout

Added in 1.0.0
Deprecated in 2.3.0
val drawerLayoutDrawerLayout?

The DrawerLayout indicating that the Navigation button should be displayed as a drawer symbol when it is not being shown as an Up button.

Returns
DrawerLayout?

The DrawerLayout that should be toggled from the Navigation button

fallbackOnNavigateUpListener

Added in 1.0.0
val fallbackOnNavigateUpListenerAppBarConfiguration.OnNavigateUpListener?

The OnNavigateUpListener that should be invoked if androidx.navigation.NavController.navigateUp returns false.

Returns
AppBarConfiguration.OnNavigateUpListener?

a OnNavigateUpListener for providing custom up navigation logic, if one was set.

openableLayout

Added in 2.3.0
val openableLayoutOpenable?

The Openable layout indicating that the Navigation button should be displayed as a drawer symbol when it is not being shown as an Up button.

Returns
Openable?

The Openable layout that should be toggled from the Navigation button

topLevelDestinations

Added in 1.0.0
val topLevelDestinationsSet<Int>

The set of destinations by id considered at the top level of your information hierarchy. The Up button will not be displayed when on these destinations.

Returns
Set<Int>

The set of top level destinations by id.