Android Interface Layout

Source: Internet
Author: User

First, LinearLayout

LinearLayout, also known as linear layout, is a very common layout that contains controls that are arranged in a linear direction.

android:orientation ="Horizontal" layout direction,vertical vertical layout, horizontal horizontal orientation

android:layout_gravity= "center" specifies how the control is aligned in the layout. It is important to note, however, that only alignment in the vertical direction will take effect when the linearlayout is in the horizontal direction, because the horizontal length is not fixed at this point, and each time a control is added, the length in the horizontal direction will change, so you cannot specify Alignment in that direction. In the same way, when the LinearLayout is vertical, only the horizontal alignment will take effect.

android:layout_weight= "1" distributes the space on the layout direction proportionally. Note: If the layout is horizontal android:layout_width= "0DP", if the vertical direction will android:layout_height= "0DP"

Second, relativelayout

Also known as relative layout, is a very common layout that allows controls to appear anywhere in the layout in a relatively positioned way.

Android:layout_alignparentleft= "True" is based on the left alignment of the parent space, with the same as the top, right, and bottom alignment.

android:layout_alignleft= "@id/button3" aligns the left edge of a space with the xxx space, while the top, right, and bottom are aligned.

Android:layout_centerinparent= "True" is based on the display in the parent space play.

Android:layout_above= "@id/button3" place space on top of xxx space

android:layout_below= "@id/button3" place space under XXX space

android:layout_toleftof= "@id/button3" place space on the left of xxx space

android:layout_torightof= "@id/button3" place space on the right side of xxx space

Third, Framelayout

Also known as a single-frame layout, is a less-used layout, and all controls are overlapped by the upper-left corner of the parent space.

Iv. Tablelayout

Using tables to arrange controls, this layout is also not very common. Each addition to a TableRow in Tablelayout indicates that a row has been added to the table.

android:stretchcolumns= "1" is used in tablelayout, which means that a column in the tablelayout is allowed to be stretched to automatically fit the screen width.

Android:layout_span= "2" is used in controls under TableRow to represent merged cells

Android Interface Layout

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.