public final class

AppBarConfiguration.Builder

extends java.lang.Object

 java.lang.Object

↳androidx.navigation.ui.AppBarConfiguration.Builder

Overview

The Builder class for constructing new AppBarConfiguration instances.

Summary

Constructors
publicBuilder(int[] topLevelDestinationIds[])

Create a new Builder with a specific set of top level destinations.

publicBuilder(Menu topLevelMenu)

Create a new Builder using a containing all top level destinations.

publicBuilder(NavGraph navGraph)

Create a new Builder whose only top level destination is the start destination of the given NavGraph.

Methods
public AppBarConfigurationbuild()

Construct the AppBarConfiguration instance.

public AppBarConfiguration.BuildersetDrawerLayout(DrawerLayout drawerLayout)

Display the Navigation button as a drawer symbol when it is not being shown as an Up button.

public AppBarConfiguration.BuildersetFallbackOnNavigateUpListener(AppBarConfiguration.OnNavigateUpListener fallbackOnNavigateUpListener)

Adds a AppBarConfiguration.OnNavigateUpListener that will be called as a fallback if the default behavior of NavController.navigateUp() returns false.

public AppBarConfiguration.BuildersetOpenableLayout(Openable openableLayout)

Display the Navigation button as a drawer symbol when it is not being shown as an Up button.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Builder(NavGraph navGraph)

Create a new Builder whose only top level destination is the start destination of the given NavGraph. The Up button will not be displayed when on the start destination of the graph.

Parameters:

navGraph: The NavGraph whose start destination should be considered the only top level destination. The Up button will not be displayed when on the start destination of the graph.

public Builder(Menu topLevelMenu)

Create a new Builder using a containing all top level destinations. It is expected that the menu item id of each item corresponds with a destination in your navigation graph. The Up button will not be displayed when on these destinations.

Parameters:

topLevelMenu: A Menu containing MenuItems corresponding with the destinations considered at the top level of your information hierarchy. The Up button will not be displayed when on these destinations.

public Builder(int[] topLevelDestinationIds[])

Create a new Builder with a specific set of top level destinations. The Up button will not be displayed when on these destinations.

Parameters:

topLevelDestinationIds: 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.

Methods

public AppBarConfiguration.Builder setDrawerLayout(DrawerLayout drawerLayout)

Deprecated: Use AppBarConfiguration.Builder.setOpenableLayout(Openable).

Display the Navigation button as a drawer symbol when it is not being shown as an Up button.

Parameters:

drawerLayout: The DrawerLayout that should be toggled from the Navigation button

Returns:

this AppBarConfiguration.Builder

public AppBarConfiguration.Builder setOpenableLayout(Openable openableLayout)

Display the Navigation button as a drawer symbol when it is not being shown as an Up button.

Parameters:

openableLayout: The Openable layout that should be toggled from the Navigation button

Returns:

this AppBarConfiguration.Builder

public AppBarConfiguration.Builder setFallbackOnNavigateUpListener(AppBarConfiguration.OnNavigateUpListener fallbackOnNavigateUpListener)

Adds a AppBarConfiguration.OnNavigateUpListener that will be called as a fallback if the default behavior of NavController.navigateUp() returns false.

Parameters:

fallbackOnNavigateUpListener: Listener that will be invoked if NavController.navigateUp() returns false.

Returns:

this AppBarConfiguration.Builder

public AppBarConfiguration build()

Construct the AppBarConfiguration instance.

Returns:

a valid AppBarConfiguration