O Google tem o compromisso de promover a igualdade racial para as comunidades negras. Saiba como.

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(navController: NavController)

Sets up a BottomNavigationView for use with a NavController.

For com.google.android.material.navigation.NavigationView
Unit
NavigationView.setupWithNavController(navController: NavController)

Sets up a NavigationView for use with a NavController.

For NavController
Boolean

Handles the Up button by delegating its behavior to the given NavController.

Boolean

Handles the Up button by delegating its behavior to the given NavController.

Top-level functions

AppBarConfiguration

inline fun AppBarConfiguration(
    navGraph: NavGraph,
    drawerLayout: Openable? = null,
    noinline fallbackOnNavigateUpListener: () -> Boolean = { false }
): 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.

Parameters
navGraph: 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.
drawerLayout: Openable? = null The Openable layout that should be toggled from the Navigation button. The the Navigation button will show a drawer symbol when it is not being shown as an Up button.
fallbackOnNavigateUpListener: () -> Boolean = { false } Lambda that will be invoked if androidx.navigation.NavController.navigateUp returns false

AppBarConfiguration

inline fun AppBarConfiguration(
    topLevelMenu: Menu,
    drawerLayout: Openable? = null,
    noinline fallbackOnNavigateUpListener: () -> Boolean = { false }
): 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.

Parameters
topLevelMenu: Menu 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.
drawerLayout: Openable? = null The Openable layout that should be toggled from the Navigation button. The the Navigation button will show a drawer symbol when it is not being shown as an Up button.
fallbackOnNavigateUpListener: () -> Boolean = { false } Lambda that will be invoked if androidx.navigation.NavController.navigateUp returns false

AppBarConfiguration

inline fun AppBarConfiguration(
    topLevelDestinationIds: Set<Int>,