Google은 흑인 공동체를 위한 인종 간 평등을 진전시키기 위해 노력하고 있습니다. Google에서 어떤 노력을 하고 있는지 확인하세요.

androidx.navigation.compose

Classes

ComposeNavigator

Navigator that navigates through Composables.

NamedNavArgument

Construct a named NavArgument by using the navArgument method.

Top-level constants summary

const String

The route linked to the current destination.

Top-level functions summary

Unit
NavHost(navController: NavHostController, startDestination: String, route: String? = null, builder: NavGraphBuilder.() -> Unit)

Provides in place in the Compose hierarchy for self contained navigation to occur.

Unit
NavHost(navController: NavHostController, graph: NavGraph)

Provides in place in the Compose hierarchy for self contained navigation to occur.

NamedNavArgument
navArgument(name: String, builder: NavArgumentBuilder.() -> Unit)

Construct a new NavArgument

NavHostController

Creates a NavHostController that handles the adding of the ComposeNavigator.

Extension functions summary

For NavGraphBuilder
Unit
NavGraphBuilder.composable(route: String, arguments: List<NamedNavArgument> = emptyList(), deepLinks: List<NavDeepLink> = emptyList(), content: (NavBackStackEntry) -> Unit)

Add the Composable to the NavGraphBuilder

Unit
NavGraphBuilder.navigation(startDestination: String, route: String, builder: NavGraphBuilder.() -> Unit)

Construct a nested NavGraph

For NavController
NavGraph
NavController.createGraph(startDestination: String, route: String? = null, builder: NavGraphBuilder.() -> Unit)

Construct a new NavGraph

State<NavBackStackEntry?>

Gets the current navigation back stack entry as a MutableState.

Unit
NavController.navigate(route: String, builder: NavOptionsBuilder.() -> Unit = {})

Navigate to a route in the current NavGraph.

For NavOptionsBuilder
Unit
NavOptionsBuilder.popUpTo(route: String, popUpToBuilder: PopUpToBuilder.() -> Unit)

Pop up to a given destination before navigating.

Top-level constants

KEY_ROUTE

const val KEY_ROUTE: String

The route linked to the current destination.

Value: "android-support-nav:controller:route"

Top-level functions

@Composable fun NavHost(
    navController: NavHostController,
    startDestination: String,
    route: String? = null,
    builder: NavGraphBuilder.() -> Unit
): Unit

Provides in place in the Compose hierarchy for self contained navigation to occur.

Once this is called, any Composable within the given NavGraphBuilder can be navigated to from the provided navController.

The builder passed into this method is remembered. This means that for this NavHost, the contents of the builder cannot be changed.

import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController

val navController = rememberNavController()
NavHost(navController, startDestination = Screen.Profile.route) {
    composable(Screen.Profile.route) { Profile(navController) }
    composable(Screen.Dashboard.route) { Dashboard(navController) }
    composable(Screen.Scrollable.route) { Scrollable(navController) }
}
Parameters
navController: NavHostController the navController for this host
startDestination: String the route for the start destination
route: String? = null the route for the graph
builder: NavGraphBuilder.() -> Unit the builder used to construct the graph
@Composable fun NavHost(
    navController: NavHostController,
    graph: NavGraph
): Unit

Provides in place in the Compose hierarchy for self contained navigation to occur.

Once this is called, any Composable within the given NavGraphBuilder can be navigated to from the provided navController.

The graph passed into this method is remembered. This means that for this NavHost, the graph cannot be changed.

Parameters
navController: NavHostController the navController for this host
graph: NavGraph the graph for this host
fun navArgument(
    name: String,
    builder: NavArgumentBuilder.() -> Unit
): NamedNavArgument

Construct a new NavArgument

rememberNavController

@Composable fun rememberNavController(): NavHostController

Creates a NavHostController that handles the adding of the ComposeNavigator.

See Also

Extension functions

composable

fun NavGraphBuilder.composable(
    route: String,
    arguments: List<NamedNavArgument> = emptyList(),
    deepLinks: List<NavDeepLink> = emptyList(),
    content: (NavBackStackEntry) -> Unit
): Unit

Add the Composable to the NavGraphBuilder

Parameters
route: String route for the destination
arguments: List<NamedNavArgument> = emptyList() list of arguments to associate with destination
deepLinks: List<NavDeepLink> = emptyList() list of deep links to associate with the destinations