Navigation 3

android/skills/navigation/navigation-3

作者 android42dc2270e960Complete terms in LICENSE.txt7.7K 个星标收录于 2026年10月8日更新于 2026年10月8日仓库13天前更新

Learn how to install and migrate to Jetpack Navigation 3, and how to implement features and patterns such as deep links, multiple backstacks, scenes (dialogs, bottom sheets, list-detail, two-pane, supporting pane), conditional navigation (such as logged-in navigation versus anonymous), returning results from flows, integration with Hilt, ViewModel, Kotlin, and view interoperability.

AI 生成的概览

面向 Android 应用的 Jetpack Navigation 3 安装、迁移与使用参考指南和代码示例。

功能
提供 Jetpack Navigation 3 的开发者文档与示例参考,涵盖安装、从 Navigation 2 迁移以及类型安全导航。文档介绍深链接、多返回栈、场景(对话框、底部弹窗、列表-详情、双窗格)、条件导航、返回结果、生命周期,以及使用 Hilt 或 Koin 的模块化等模式。产出的是指导说明和代码示例,而非可执行产物。
适用场景
在构建或迁移使用 Jetpack Navigation 3 的 Android 应用,并需要实现模式或迁移步骤时使用。也适合查阅特定示例,如深链接、场景或多返回栈。
运行要求
无脚本,仅包含说明和参考文档。需要 Android 开发环境,使用 Jetpack Compose 和 Navigation 3;模块化示例可选需要 Hilt、Dagger 或 Koin。

Migration guide

  • Navigation 2 to Navigation 3 migration guide [blocked]: Step-by-step guide to migrate an Android application from Navigation 2 to Navigation 3, covering dependency updates, route changes, state management, and UI component replacements.

Requirements

  • Guide: Migrate to type-safe navigation in Compose [blocked] : Step-by-step guide to migrating an Android application from string-based navigation to Type-Safe Navigation in Jetpack Compose using Jetpack Navigation 2.

Developer documentation

  • Navigation 3 [blocked]. Search documentation for more information on basics, saving and managing navigation state, modularizing navigation code, creating custom layouts using Scenes, animating between destinations, or applying logic or wrappers to destinations.

Recipes

Code examples showcasing common patterns.

Basic API usage

  • Basic [blocked]: Shows most basic API usage.
  • Saveable back stack [blocked]: Shows basic API usage with a persistent back stack.
  • Entry provider DSL [blocked]: Shows basic API usage using the entryProvider DSL.

Common UI

  • Common UI [blocked]: Demonstrates how to implement a common navigation UI pattern with a bottom navigation bar and multiple back stacks, where each tab in the navigation bar has its own navigation history.

Deep links

  • Static URI [blocked]: Shows how to handle simple static URI deep links.
  • URI with Arguments [blocked]: Shows how to parse path and query arguments from a deep link.
  • Synthetic BackStack [blocked]: Shows how to handle deep links with a synthetic back stack.
  • Custom Matcher [blocked]: Shows how to implement custom deep link matching logic.

Scenes

Use built-in Scenes
  • Dialog [blocked]: Shows how to create a Dialog.
Create custom Scenes
  • BottomSheet [blocked]: Shows how to create a BottomSheet destination.
  • List-Detail Scene [blocked]: Demonstrates how to implement adaptive list-detail layouts using the Navigation 3 Scenes API.
  • Two pane Scene [blocked]: Demonstrates how to implement adaptive two-pane layouts using the Navigation 3 Scenes API.

Material Adaptive

  • Material List-Detail [blocked]: Demonstrates how to implement an adaptive list-detail layout using Material 3 Adaptive.
  • Material Supporting Pane [blocked]: Demonstrates how to implement an adaptive supporting pane layout using Material 3 Adaptive.

Animations

  • Animations [blocked]: Shows how to override the default animations for all destinations and a single destination.
  • Conditional Transitions [blocked]: Shows how to implement conditional transition animations.

Common back stack behavior

  • Multiple back stacks [blocked]: Shows how to create multiple top level routes, each with its own back stack. Top level routes are displayed in a navigation bar allowing users to switch between them. State is retained for each top level route, and the navigation state persists config changes and process death.

Conditional navigation

  • Conditional navigation [blocked]: Switch to a different navigation flow when a condition is met. For example, for authentication or first-time user onboarding.

Lifecycle

  • Lifecycle Owner [blocked]: Shows how to use and observe Lifecycle in Navigation 3.

Architecture

  • Modularized navigation code (Hilt) [blocked]: Demonstrates how to decouple navigation code into separate modules using Hilt or Dagger for DI.
  • Modularized navigation code (Koin) [blocked]: Demonstrates how to decouple navigation code into separate modules using Koin for DI.

Working with ViewModel

Passing navigation arguments
  • Basic ViewModel [blocked] : Navigation arguments are passed to a ViewModel constructed using viewModel()

Returning results

  • Returning Results as Events [blocked] : Returning results as events to content in another NavEntry
  • Returning Results as State [blocked] : Returning results as state stored in a CompositionLocal

来源与署名

来源:android/skills位于navigation/navigation-3提交42dc227

许可证: Complete terms in LICENSE.txt

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架

更多来自 android/skills 的技能

Wear Compose M3

android

指导构建、更新和迁移 Wear OS Compose Material3 应用,并提供规范组件示例与版本规则。

Software Development7.7K13天前更新

Display Glasses With Jetpack Compose Glimmer

android

Provides guidelines for developing projected Android XR apps for display glasses using the Jetpack Compose Glimmer UI toolkit. This skill covers foundational Glimmer design principles, workflows for implementing Jetpack Compose Glimmer, and interaction models for the glasses form factor. Use this skill to build an Android XR Augmented Experience app with Jetpack Compose Glimmer that adheres to the Glimmer design system for optimized glasses styling.

待分类7.7K13天前更新

Play Billing Library Version Upgrade

android

指导将 Android 项目从旧版 Google Play 结算库升级到最新稳定版本。

Software Development7.7K13天前更新

Leanback To Compose Tv Migration

android

Provides instructions and architectural patterns for migrating Android TV applications from legacy Leanback UI Toolkit, Android Views, or Support Fragments to Jetpack Compose for TV (androidx.tv). Use this skill for Leanback to Compose migrations, including browse screen, settings screen, authentication screen, login screen, or video playback screen migrations, or when replacing BrowseSupportFragment, LeanbackSettingsFragment, PreferenceFragment, BaseLeanbackPreferenceFragmentCompat, VideoSupportFragment, GuidedStepSupportFragment, SearchSupportFragment, VerticalGridSupportFragment, Presenter, ArrayObjectAdapter, or CursorMapper with modern Compose equivalents, implementing immersive carousels with focus memory, Media3 video playback with PlayerSurface, or custom 10-foot hero layouts.

待分类7.7K13天前更新

Testing Setup

android

分析 Android 项目的测试配置,并安装测试框架、测试装置以及单元、UI、截图和端到端测试。

Software Development7.7K13天前更新

Android Profiler

android

指导 Android 性能分析:录制系统跟踪、堆转储和方法记录,并使用 Perfetto SQL 进行分析。

Software Development7.7K13天前更新