The Navigation Editor is a tool used to create and structure the layouts of the application using a graphical viewer. To open this tool, navigate to Tools | Android | Navigation Editor. This tool opens a file in XML format, named main.nvg.xml
. This file is stored in your project at /.navigation/app/raw/
.
Since there is only one layout (and one activity) in our project, the navigation editor only shows this main layout. If you select the layout, detailed information about it is displayed on the panel on the right-hand side of the editor. If you double-click on the layout, the XML layout file will be opened in a new tab.
We can create a new activity by right-clicking on the editor and selecting the New Activity option. We can also add transitions from the controls of a layout by shift clicking on a control and then dragging to the target activity.
Open the main layout and create a new button with the Open Activity
label:
<Button android:id="@+id/button_open" ...