setup Navigation
Sets up navigation for NavDrawerLayout with a DrawerNavigationView and NavHostFragment. Supports both XML and programmatically created navigation graphs (NavGraphBuilder DSL).
Parameters
The DrawerNavigationView containing the navigation menu to be linked with navigation actions.
The NavHostFragment that hosts the navigation graph and manages navigation transactions.
Optional AppBarConfiguration to customize top-level destinations and drawer behavior. By default, uses the menu from drawerNavigationView and this NavDrawerLayout as the drawer layout.
The threshold (from 0.0 to 1.0) at which the NavDrawerLayout toolbar switches its title, subtitle and navigation icon to those of the back destination during predictive back animation progress. Defaults to 0.75f.
By default, the back stack will be popped back to the navigation graph's start destination except for Activity and FloatingWindow destinations and for menu items that have android:menuCategory="secondary"
.
Usage example:
navDrawerLayout.setupNavigation(drawerNavigationView, navHostFragment)
See also
Overload for programmatic navigation graph creation using NavGraphBuilder DSL.
Example usage:
navDrawerLayout.setupNavigation(
drawerNavigationView,
navHostFragment,
startDestination = "widgets_dest"
) {
mainNavGraph()
}
Sets up navigation for ToolbarLayout with a BottomTabLayout and NavHostFragment. Supports both XML and programmatically created navigation graphs (NavGraphBuilder DSL).
Parameters
The BottomTabLayout to be linked with navigation actions.
The NavHostFragment that hosts the navigation graph and manages navigation transactions.
Optional AppBarConfiguration to customize top-level destinations and drawer behavior. By default, uses the menu from the bottomTabLayout.
The threshold (from 0.0 to 1.0) at which the ToolbarLayout toolbar switches its title, subtitle and navigation icon to those of the back destination during predictive back animation progress. Defaults to 0.75f.
By default, the back stack will be popped back to the navigation graph's start destination except for Activity and FloatingWindow destinations and for menu items that have android:menuCategory="secondary"
.
Usage example:
toolbarLayout.setupNavigation(bottomTabLayout, navHostFragment)
See also
Overload for programmatic navigation graph creation using NavGraphBuilder DSL.
Example usage:
toolbarLayout.setupNavigation(
bottomTabLayout,
navHostFragment,
startDestination = "widgets_dest"
) {
mainNavGraph()
}