Android Development interface Design six major layouts introduction

Source: Internet
Author: User

1. Frame Layout framelayout:

Framelayout is the simplest layout object. All of the displayed objects in it will be fixed in the upper left corner of the screen, cannot be specified, and the latter will be displayed directly above the previous one.

2. Linear layout LinearLayout:

LinearLayout is one of the most commonly used layouts, and is also the parent class of Radiogroup, Tabwidget, Tablelayout, TableRow, zoomcontrols classes, all of which display objects in vertical or horizontal Arrangement (by setting the Orentation property of the LinearLayout to set the arrangement mode)

3. Relative layout relativelayout:

Relativelayout allows child elements to specify their position relative to their parent or sibling elements, which is one of the most common layout methods in the actual layout. It is flexible, has many properties, the operation is more difficult, the possibility of conflict between attributes is also large, the use of relative layout needs to do more testing.

Some of the important attributes that Relativelayout uses:
First Class: Property value is True or False
Android:layout_centerhrizontal-------------------------------Horizontal Center
Android:layout_centervertical---------------------------------vertically Centered
Android:layout_centerinparent--------------------------------completely centered relative to the parent element
Android:layout_alignparentbottom----------------------------snaps to the bottom edge of the parent element
Android:layout_alignparentleft--------------------------------snaps to the left edge of the parent element
Android:layout_alignparentright------------------------------snaps to the right edge of the parent element
Android:layout_alignparenttop--------------------------------snaps to the top edge of the parent element
Android:layout_alignwithparentifmissing----------------------A reference to the parent element if the corresponding sibling element is not found.
Second class: The attribute value must be the reference name of the id "@id/id-name"
Android:layout_below-----------------------------------------at the bottom of an element
Android:layout_above----------------------------------------at the top of an element
Android:layout_toleftof--------------------------------------on the left side of an element
Android:layout_torightof-------------------------------------on the right side of an element
Android:layout_aligntop--------------------------------------align the top edge of this element with the top edge of an element
Android:layout_alignleft--------------------------------------The left edge of this element is aligned with the left edge of an element
Android:layout_alignbottom----------------------------------The bottom edge of this element aligns with the bottom edge of an element
Android:layout_alignright-------------------------------------align the right edge of this element with the right edge of an element
Class III: Attribute values are specific pixel values, such as 30dip,40px
Android:layout_marginbottom--------------------------------distance from the bottom edge of an element
Android:layout_marginleft------------------------------------distance from the left edge of an element
Android:layout_marginright----------------------------------distance from the right edge of an element
Android:layout_margintop------------------------------------distance from the top edge of an element

4. Table Layout tablelayout:

Tablelayout manages child elements in the form of rows, each of which is a TableRow layout object, or it can be a normal view object, TableRow each element is a column, and the total number of columns is determined by the row with the highest number of columns.

Several important properties of Tablelayout:

Collapsecolumns-----------------------------set to hide those columns, column IDs start at 0, and multiple columns are separated by ","
Stretchcolumns------------------------------Set automatic stretching of those columns, column IDs starting from 0, multiple columns with "," delimited
Shrinkcolumns-------------------------------settings automatically shrink those columns, column IDs start at 0, and multiple columns with "," Dividers can use "*" to represent all columns, The same column can be set to both Shrinkable and stretchable. 5. Absolute layout absolutelayout:

The container manages the position size of the controls in the container, and the developer specifies the position of the component by specifying X, y coordinates

Android:layout_x, specifying the x-coordinate value of the control in the container

Android:layout_y, specifying the y-coordinate value of the control in the container

In practice, absoultelayout is generally not applicable, because the app's phone screen size, the resolution will certainly be different

6. Grid Layout girdlayout:

GridLayout Grid Layout Manager is an addition to the layout manager after Android 4.0

The Grid Layout manager divides the container into a grid of row x columns, each of which is placed in a grid, or you can set a control to occupy multiple rows or columns by setting the related properties

For example, you can use a grid layout to do a calculator.

Android Development interface Design six major layouts introduction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.