AppBarConfiguration.Builder
public final class AppBarConfiguration.Builder
The Builder class for constructing new AppBarConfiguration instances.
Summary
Public constructors |
|---|
|
Create a new Builder whose only top level destination is the start destination of the given |
Builder(int... topLevelDestinationIds)Create a new Builder with a specific set of top level destinations. |
|
Create a new Builder with a specific set of top level destinations. |
|
Create a new Builder using a |
Public methods |
|
|---|---|
final @NonNull AppBarConfiguration |
build()Construct the |
final @NonNull AppBarConfiguration.Builder |
This method is deprecated. Use {@link #setOpenableLayout(Openable)}. |
final @NonNull AppBarConfiguration.Builder |
setFallbackOnNavigateUpListener(Adds a |
final @NonNull AppBarConfiguration.Builder |
setOpenableLayout(Openable openableLayout)Display the Navigation button as a drawer symbol when it is not being shown as an Up button. |
Public constructors
Builder
public Builder(@NonNull 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.
Builder
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 | |
|---|---|
int... 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. |
Builder
public Builder(@NonNull Set<@NonNull Integer> topLevelDestinationIds)
Create a new Builder with a specific set of top level destinations. The Up button will not be displayed when on these destinations.
Builder
public Builder(@NonNull Menu topLevelMenu)
Create a new Builder using a Menu 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.
Public methods
build
public final @NonNull AppBarConfiguration build()
Construct the AppBarConfiguration instance.
| Returns | |
|---|---|
@NonNull AppBarConfiguration |
a valid |
public final @NonNull AppBarConfiguration.BuildersetDrawerLayout(DrawerLayout drawerLayout)
Display the Navigation button as a drawer symbol when it is not being shown as an Up button.
| Parameters | |
|---|---|
DrawerLayout drawerLayout |
The DrawerLayout that should be toggled from the Navigation button |
| Returns | |
|---|---|
@NonNull AppBarConfiguration.Builder |
this |
setFallbackOnNavigateUpListener
public final @NonNull AppBarConfiguration.Builder setFallbackOnNavigateUpListener(
AppBarConfiguration.OnNavigateUpListener fallbackOnNavigateUpListener
)
Adds a OnNavigateUpListener that will be called as a fallback if the default behavior of androidx.navigation.NavController.navigateUp returns false.
| Parameters | |
|---|---|
AppBarConfiguration.OnNavigateUpListener fallbackOnNavigateUpListener |
Listener that will be invoked if |
| Returns | |
|---|---|
@NonNull AppBarConfiguration.Builder |
this |
setOpenableLayout
public final @NonNull AppBarConfiguration.Builder setOpenableLayout(Openable openableLayout)
Display the Navigation button as a drawer symbol when it is not being shown as an Up button.
| Parameters | |
|---|---|
Openable openableLayout |
The Openable layout that should be toggled from the Navigation button |
| Returns | |
|---|---|
@NonNull AppBarConfiguration.Builder |
this |