Reproduced please indicate the source [www.jianshu.com/p/c4697590e…]
introduce
After the update, there is another highlight, which is Navigation Editor (Navigation Editor).
Navigation
Speaking of Navigation Editor, we have to say a little bit about Navigation.
What is the Navigation
In Android development, navigation is an interactive component that allows users to enter and exit different content within an application. The navigation component of Android Jetpack helps us navigate. The navigation component also makes it possible to follow established guidelines to ensure that users have a good user health check.
Composition of navigation components
The navigation component consists of three key parts:
- Navigation Graph: This is an XML resource file that contains all the information related to location Navigation. This includes all the individual content areas within the application (called the target view) and the paths that connect the various “targets” within the application.
- NavHost: An empty container for displaying the target view in the navigation diagram. The Navigation component contains a default NavHost that implements navHostFragments and is used to display the fragment’s destination.
- NavController: The object that manages the navigation of applications in NavHost. As the user moves through the application, the NavController coordinates the exchange of the target content in NavHost.
When we navigate through our application, we can notify the NavController that we want to navigate along a specific path in the navigation diagram, or navigate directly to a specific destination. The NavController can then display the appropriate target view in NavHost.
Navigation components have a number of benefits:
- Can handle fragment transactions.
- By default, operations between items are handled correctly.
- Can provide standardized transition animation resources.
- Implement and handle deep linking.
- Some navigation UI patterns are covered, such as drawer navigation and bottom navigation with little extra work.
- Safe Args – A Gradle plug-in that provides secure data types when navigating and passing data between destinations.
Ok, let’s see how to use it
Do you know how to use Google Navigation?
The project address
Github.com/yang0range/…