Android 12 Developer Preview is here! Try it out, and give us your feedback!

androidx.navigation.ui

Interfaces

OnNavigateUpListener

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

Classes

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.

NavigationUI

Class which hooks up elements typically in the 'chrome' of your application such as global navigation patterns like a navigation drawer or bottom nav bar with your NavController.

Top-level functions summary

AppBarConfiguration
AppBarConfiguration(navGraph: NavGraph, drawerLayout: Openable? = null, noinline fallbackOnNavigateUpListener: () -> Boolean = { false })

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.

AppBarConfiguration
AppBarConfiguration(topLevelMenu: Menu, drawerLayout: Openable? = null, noinline fallbackOnNavigateUpListener: () -> Boolean = { false })

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.

AppBarConfiguration
AppBarConfiguration(topLevelDestinationIds: Set<Int>, drawerLayout: Openable? = null, noinline fallbackOnNavigateUpListener: () -> Boolean = { false })

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.

Extension functions summary

For android.view.MenuItem
Boolean

Attempt to navigate to the NavDestination associated with this MenuItem.

For androidx.appcompat.app.AppCompatActivity
Unit

Sets up the ActionBar returned by AppCompatActivity.getSupportActionBar for use with a NavController.

Unit
AppCompatActivity.setupActionBarWithNavController(navController: NavController, configuration: AppBarConfiguration = AppBarConfiguration(navController.graph))

Sets up the ActionBar returned by AppCompatActivity.getSupportActionBar for use with a NavController.

For androidx.appcompat.widget.Toolbar
Unit
Toolbar.setupWithNavController(navController: NavController, drawerLayout: DrawerLayout?)

Sets up a Toolbar for use with a NavController.

Unit
Toolbar.setupWithNavController(navController: NavController, configuration: AppBarConfiguration = AppBarConfiguration(navController.graph))

Sets up a Toolbar for use with a NavController.

For com.google.android.material.appbar.CollapsingToolbarLayout
Unit
CollapsingToolbarLayout.setupWithNavController(toolbar: Toolbar, navController: NavController, drawerLayout: DrawerLayout?)

Sets up a CollapsingToolbarLayout and Toolbar for use with a NavController.

Unit
CollapsingToolbarLayout.setupWithNavController(toolbar: Toolbar, navController: NavController, configuration: AppBarConfiguration = AppBarConfiguration(navController.graph))

Sets up a CollapsingToolbarLayout and Toolbar for use with a NavController.

For com.google.android.material.bottomnavigation.BottomNavigationView
Unit
BottomNavigationView.setupWithNavController(