Edit UI layout using text editor
Now when you are familiar with the basic UI layout editing options using the built-in designer, let's add more elements to the main view of the application by editing its layout manually.
1. Switch to Text view
Switch to the Text tab at the bottom of the editor. IntelliJ IDEA will display the XML source code of the currently selected layout file:
2. Add a horizontal ruler
Let's add some markup that inserts a separator. The easiest way to add a horizontal dividing line is adding the following to your source code:
The separator is 5 units thick, painted with a green background and placed below the nearest element.
3. Add a TextView element
To add another TextView element, add the following to your source code:
The new element will be placed 60 units below the separator; it is centered horizontally and uses the default font color. The text string associated with the element is declared explicitly.
Unlike the separator, though, the TextView element also has the id property. Its syntax indicates that what follows the "/" symbol, is a string that must be treated as an ID resource, and will be used to reference the view element. The Android runtime processes this information appropriately and makes it possible for you to write Java code that interacts with the TextView component.
The Preview pane on the right displays the result of your changes: