[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Principles of navigation\n\nNavigation between different screens and apps is a core part of the user\nexperience. The following principles set a baseline for a consistent and\nintuitive user experience across apps. The\n[Navigation component](/topic/libraries/architecture/navigation) is designed to\nimplement these principles by default, ensuring that users can apply the same\nheuristics and patterns in navigation as they move between apps.\n| **Note:** Even if you aren't using the Navigation component in your project, your app should follow these design principles.\n\nFixed start destination\n-----------------------\n\nEvery app you build has a fixed start destination. This is the first screen the\nuser sees when they launch your app from the launcher. This destination is also\nthe last screen the user sees when they return to the launcher after pressing\nthe Back button. Let's take a look at the\n[Sunflower app](https://github.com/android/sunflower/tree/main/app)\nas an example.\n\n**Figure 1.** The List Screen is the Sunflower app's start destination.\n\nWhen launching the Sunflower app from the launcher, the first screen that a user\nsees is the **List Screen**, the list of plants in their garden. This is also\nthe last screen they see before exiting the app. If they press the Back button\nfrom the list screen, they navigate back to the launcher.\n| **Note:** An app might have a one-time setup or series of login screens. These [conditional screens](/topic/libraries/architecture/navigation/navigation-conditional) should not be considered start destinations because users see these screens only in certain cases.\n\nNavigation state is represented as a stack of destinations\n----------------------------------------------------------\n\nWhen your app is first launched, a\n[new task](/guide/components/activities/tasks-and-back-stack)\nis created for the user, and app displays its start destination. This becomes\nthe base destination of what is known as the *back stack* and is the basis for\nyour app's navigation state. The top of the stack is the current screen, and the\nprevious destinations in the stack represent the history of where you've been.\nThe back stack always has the start destination of the app at the bottom of the\nstack.\n\nOperations that change the back stack always operate on the top of the stack,\neither by pushing a new destination onto the top of the stack or popping the\ntop-most destination off the stack. Navigating to a destination pushes that\ndestination on top of the stack.\n\nThe [Navigation component](/topic/libraries/architecture/navigation) manages\nall of your back stack ordering for you, though you can also choose to manage\nthe back stack yourself.\n\nUp and Back are identical within your app's task\n------------------------------------------------\n\n**Figure 2.** The Up and Back buttons\n\nThe Back button appears in the system navigation bar at the bottom of the screen\nand is used to navigate in reverse-chronological order through the history of\nscreens the user has recently worked with. When you press the Back button, the\ncurrent destination is popped off the top of the back stack, and you then\nnavigate to the previous destination.\n\nThe Up button appears in the [app bar](/training/appbar) at the top of the\nscreen. Within your app's task, the Up and Back buttons behave identically.\n\nThe Up button never exits your app\n----------------------------------\n\nIf a user is at the app's start destination, then the Up button does not appear,\nbecause the Up button never exits the app. The Back button, however, is shown\nand does exit the app.\n\nWhen your app is launched using a [deep link](/training/app-links/deep-linking)\non another app's task, Up transitions users back to your app's task and through\na [simulated back stack](#deep-link) and not to the app that triggered the deep\nlink. The Back button, however, does take you back to the other app.\n\nDeep linking simulates manual navigation\n----------------------------------------\n\nWhether [deep linking](/training/app-links/deep-linking) or manually navigating\nto a specific destination, you can use the Up button to navigate through\ndestinations back to the start destination.\n\nWhen deep linking to a destination within your app's task, any existing back\nstack for your app's task is removed and replaced with the deep-linked back\nstack.\n\nUsing the Sunflower app again as an example, let's assume that the user had\npreviously launched the app from the launcher screen and navigated to the detail\nscreen for an apple. Looking at the Recents screen would indicate that a task exists with the top most screen being the detail screen for the Apple.\n\n**Figure 3.** User navigation through the Sunflower app and the resulting back\nstack.\n\nAt this point, the user can tap the Home button to put the app in the\nbackground. Next, let's say this app has a deep link feature that allows users\nto launch directly into a specific plant detail screen by name. Opening the app\nvia this deep link completely replaces the current Sunflower back stack shown in\nfigure 3 with a new back stack, as shown in figure 4:\n\n**Figure 4.** Following a deep link replaces the existing back stack for the\nSunflower app.\n\nNotice that the Sunflower back stack is replaced by a *synthetic back stack*\nwith the avocado detail screen at the top. The *My Garden* screen, which is the\nstart destination, was also added to the back stack. The original Sunflower back\nstack is gone, including the app's knowledge that the user was on the Apple\ndetails screen before. All of this is important because the synthetic back stack\nmust be realistic. It should match a back stack that could have been achieved by\norganically navigating through the app.\n\nTo meet this need, the synthetic back stack that is created is a simplified one\nbased on the `NavGraph`. For a simple `NavGraph` without nesting, this will\nconsist of the start destination and the deep link destination. For more\ncomplex, [nested navigation graphs](/guide/navigation/navigation-nested-graphs),\nthe synthetic back stack will also contain the start destinations of any nested\ngraphs that are ancestors of the deep link destination.\n\nThe Navigation component\n[supports deep linking](/topic/libraries/architecture/navigation/navigation-deep-link)\nand recreates a realistic back stack for you when linking to any destination in\nyour navigation graph."]]