Chapter 12. Using the Graphical Editor
By far the easiest and most productive way to design a user interface (UI) in Android apps is to use the Graphical Layout tools. In the past, these have been difficult to use, sometimes creating code that was hard to understand and had other practical limitations. But the tools have improved over successive releases. They are getting close to the standard set used by GUI builders for Windows or iOS, and now work better than the Android alternative (manually editing XML files). They make it easy to generate the user interface, refactor existing layouts, visualize your UI on multiple environments, and much more. They can make development more efficient and ensure that you are creating well-formed layout code.
Generating Layouts Using the Graphical Layout Editor
If editing XML isn’t your thing, there is a graphical tool that allows you to drag and drop UI components to construct a layout. You will use this to create your basic layouts, then modify the XML to fine-tune your layouts.
The Graphical Layout editor (see Figure 12-1) can be accessed by selecting the appropriate tab (on the bottom left) of any Android layout.xml file. Selecting this tab presents you with a perspective containing the tools you can use to construct your interface. Switch back to the XML view by selecting the tab showing the layout filename. The two views are kept in sync when you save the file.
This tool has a few different components that ...