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。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 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
- Guide: Migrate to type-safe navigation in Compose : 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. 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: Shows most basic API usage.
- Saveable back stack: Shows basic API usage with a persistent back stack.
- Entry provider DSL: Shows basic API usage using the entryProvider DSL.
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
- Static URI: Shows how to handle simple static URI deep links.
- URI with Arguments: Shows how to parse path and query arguments from a deep link.
- Synthetic BackStack: Shows how to handle deep links with a synthetic back stack.
- Custom Matcher: Shows how to implement custom deep link matching logic.
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
评论
- …
同一仓库的更多技能
agp-9-upgrade
10k帮你的智能体把 Android 应用升级到 Android Gradle Plugin 9,并处理其中的破坏性变更。不适用于多平台项目。
camerax
10k帮你的智能体使用 CameraX 构建 Android 相机功能,包括视频录制、硬件控制以及 ML Kit 和 Media3 效果。
android-for-cars-parked-apps
10k帮你的智能体把 Android 视频、游戏或浏览器应用调整为可在 Android Auto 和 Android Automotive 上以停放应用形式运行。
appfunctions
10k帮你的智能体在 Android 应用中找到关键工作流,并把它们暴露为 AI 智能体和语音命令可以运行的 AppFunctions。