Using Layout Editor

What's New in the Android Developer Tools?

Android Studio offers powerful layout editor that allows you to drag-and-drop widgets into the layout and look of your layout when editing XML.
In the layout editor, you can switch between text, where you edit the XML file as text, and display design. Just click the appropriate tab at the bottom of the window to display the desired editor.

Editing in Text View

You can use the display to edit the text file of your layout. This section describes some of the features available in text view.

Preview
While editing in text view, you can see the layout of the device are available by opening the Preview pane on the right side of the window. In the Preview pane, you can modify the preview by changing the various options in the top panel, including the preview tool, the layout of the theme, version of the platform and more. To see a preview of how your application will look at the skin a specific device, click the icon preview and choose the desired device.


To see the layout on multiple devices simultaneously, choose Preview All screen size of the drop-down list. When you click on the picture display, layout editor highlighting the appropriate section in XML, and vice versa. Interactive error detection and recovery. When you edit an XML file text display layout, Android Studio flag typos and offer assistance.
For example, you add a button, and you misspell it as "Buttonn". Android Studio help you to fix it by displaying an error such as the following, where you can click "Change Button" to correct the error in the XML file:
Android Studio also ask you to provide the missing information. For example, you start adding the fragment to an XML file of your layout. First of all, Android Studio featuring auto-complete suggestions as you type. Once it became clear that you add fragments, Android Studio display panel error with a link that you can click to supply the missing attributes. Click the "Automatically add all the attributes are lost" in this case not only was it completed the definition of fragments in your XML layout files:


Choose a theme
To choose a theme for your application, click the icon theme.
It will display the Choose Theme dialog, where you can search for a specific theme and / or select one from the list on the right side. The theme you choose will be reflected in the first image.



Localization
Android Studio provides built-in support for localization. When you click the icon localization, you can select a specific location, add and edit translations, local preview of supported applications (all locally or just a single local), and preview the layout of the right-to-left for RTL languages.
See Supporting different languages ​​for an explanation of how to support different locales in the app.
For example, here is a preview of the "Hello World" application for locale:


Editing in Design View
You can switch to a graphical editor by clicking Design at the bottom of the window. While editing in Design view, you can show and hide the widget are available for drag-and-drop palette by clicking on the left side of the window. Designer Clicking on the right side panel with a window revealing the hierarchy layout and a list of properties for each view in the layout.
When you drag a widget to the graphic layout for your application, the display changes to help you place the widget. What you see depends on what kind of layout. For example, if you drag a widget into FrameLayout. In the graphical editor, you can rearrange your application UI widgets by dragging to the desired location.

Take a snapshot
When you run your application on a connected device, you can take snapshots of the device by clicking on the camera icon in the left pane logging (at the bottom of the window by default). It takes a snapshot of your applications that are running (or whatever is being displayed on your device) and display it in a window. Check the frame screenshot to show you a screenshot of the skin device of your choice. You can also specify whether you want the image to have a glare screen and / or a drop shadow. Once you have the desired effect, you can save the image.

You can use the same process to create a snapshot preview of your application. Simply click the camera icon in the preview area and follow the steps to add the skin.

Android Studio

Next Tutorial