跳到正文
Skillpedia
移动应用10k · #11924

navigation-3

它能做什么

这个技能指导安装和迁移到 Jetpack Navigation 3,即 Android 较新的导航库。它还涵盖深层链接、多返回栈以及底部弹出面板等模式。适合迁移到 Navigation 3 或使用它进行开发的 Android 开发者。

适用场景

  • ✓当你想把 Android 应用从 Navigation 2 迁移到 Navigation 3 时。
  • ✓当你需要多个返回栈,例如各自拥有独立历史记录的标签页时。
  • ✓当你希望通过导航处理深层链接、对话框或底部弹出面板的时候。

技能链接

https://github.com/android/skills/blob/main/navigation/navigation-3/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/android/skills/blob/main/navigation/navigation-3/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请把我的 Android 应用从 Navigation 2 迁移到 Navigation 3,并确保原有界面仍然正常工作。”

每周 5 个新技能,1 分钟读完。

工作原理

该技能遵循迁移指南,涵盖依赖更新、路由变更和状态处理。然后它会展示如何设置深层链接、场景以及从流程返回结果等模式。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。


Migration guide

  • Navigation 2 to Navigation 3 migration guide: 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

Developer documentation

  • Navigation 3. 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

Common UI

  • Common UI: 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

Scenes

Use built-in Scenes

  • Dialog: Shows how to create a Dialog.

Create custom Scenes

  • BottomSheet: Shows how to create a BottomSheet destination.
  • List-Detail Scene: Demonstrates how to implement adaptive list-detail layouts using the Navigation 3 Scenes API.
  • Two pane Scene: Demonstrates how to implement adaptive two-pane layouts using the Navigation 3 Scenes API.

Material Adaptive

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

Animations

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

Common back stack behavior

  • Multiple back stacks: 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

常见问题

它涵盖从字符串路由迁移吗?

涵盖。它会指向一份指南,作为迁移的一部分,说明如何迁移到 Compose 中的类型安全导航。

它能帮助处理已登录和未登录的流程吗?

能。它涵盖条件导航,例如为已登录用户和匿名用户显示不同的界面。

它涵盖 Hilt 和 ViewModel 吗?

涵盖。它包括与 Hilt、ViewModel 和 Kotlin 的集成。

详情

作者的原始描述

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.

repo: android/skills

热度

GitHub 星标
10k
排名
#11924
许可证
Apache-2.0
更新时间
2026/10/29

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能