Common android Layout

Source: Internet
Author: User

1. Linear layout LinearLayout

Purpose: arrange the components in the container one by one. This not only controls the horizontal arrangement of each component, but also controls the vertical arrangement of each component (through android: orientation attribute control). features: linear layout does not wrap the line. When a component is arranged in the header one by one, the remaining components do not display attributes:

Android: gravity sets the alignment of components in the layout manager. This attribute supports top, bottom, left, right, center_vertical, fill_vertical, center_horizontal, fill_horizontal, center, fill, clip_vertical, clip_horizontal attribute values. You can also specify multiple alignment combinations. android: orientation sets the arrangement of components in the layout manager. Ii. TableLayout

Purpose: The table layout uses columns to manage the UI components. Features: you do not need to specify the number of rows and columns of baohang. You can add TableRow and other components to control the number of rows and columns of the table, each time you add a TableRow, It is a row of the table and TableRow is a container. Therefore, it can add other components continuously. Each time you add a sub-component, a column is added to the table. If you directly add a component to TableLayout, this component directly occupies one attribute column:

Android: collapseColumns sets the column numbers of columns to be hidden. Separate multiple column numbers with commas (,). android: shrinkColumns sets the column numbers that can be shrunk, separate multiple sequence numbers with commas (,). adnroid: stretchColumns: Specifies the sequence numbers of columns that can be stretched. Separate multiple sequence numbers with commas (,). Iii. Frame layout FrameLayout

Purpose: Create a blank area (called a frame) for each component to be added. The feature is that all child components occupy one frame, and these frames are automatically aligned based on the gravity attribute:

Android: foreground: sets the foreground image of the container for this frame layout. android: foregroundGravity defines the gravity attribute of the foreground image. Iv. Relative layout RelativeLayout

Role: the position of the child components in the relative layout container is always determined by the sibling component and parent container. Therefore, this layout method is called relative Layout features: if the position of component A is determined by the position of component B, Android requires that component B be defined first and the attributes of component A be defined:

Android: gravity: sets the alignment of child components in the layout container. android: ignoreGravity: sets the component to ignore the influence of gravity components. 5. Absolute layout Absolutelayout

Function: controls the position of a component using the x coordinate y coordinate. When AbsoluteLayout is used as the layout container, the layout container no longer manages the position and size attributes of the Child component:

Layout_x: Specifies the x coordinate of the Child component layout_y specifies the y coordinate of the Child component

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.