Understanding the layout is very important for a good Android Application Design. In this tutorial, we provide an overview of how to adapt the layout to the Android application architecture. We also explored some specific available layout controls that can be used to organize application screen content in various ways.
What is layout?
Android Developers use the term "layout", which refers to one of the two meanings. The two definitions are used in this tutorial, and unfortunately they are mixed in the Android development community. Two la s are defined as follows:
A resource that defines what to draw on the screen. Layout resources are stored in the XML file under the/res/layout Resource Directory of the application. A Layout resource is simply a template used for a user interface screen, a part of the screen, and content.
A View class that organizes other controls. These layout classes include LinearLayout, RelativeLayout, and TableLayout. They are used to display child controls, such as text controls, buttons, and images on the screen.
The Android user interface can be defined as a dynamic creation of layout resources or programs in XML.
Use Eclipse to design and layout Resources
The Android development plug-in of Eclipse contains a convenient layout Resource Designer for designing and previewing layout resources. This tool includes two tag views: the layout view allows you to preview the display of controls on different screens and in each direction. The XML view tells you the XML definition of the resource. The layout Resource Designer is as follows:
Here are some tips for using the layout resource editor in Eclipse:
◆ Use the overview Outline) pane to add and delete controls in your layout resources.
◆ Select a specific control in the preview or summary window) and use the properties pane to adjust the properties of a specific control.
◆ Use XML tags to directly edit XML definitions.
It is important to remember that the Eclipse layout resource editor cannot accurately simulate the presentation of the layout on the end user. To do this, you must test it in a properly configured simulator, and more importantly, test it on the target device. Some "complex" controls, including tags or video viewers, cannot be previewed in Eclipse.