Preliminary Design of Android UI (basic layout)

Source: Internet
Author: User

1. Linear layout LinearLayout)

Linear layout is one of the simplest layout types that Android Developers use most. developers use it to organize controls on your user interfaces. The linear layout functions like its name: it organizes controls in a vertical or horizontal form. When the layout direction is set to vertical, all child controls in the layout are organized in the same column. When the layout direction is set to normal, all child controls are organized in one row.

Linear layout can be defined in the XML layout resource file, or dynamically defined using Java code in the program.

Shows the linear layout of seven TextView controls. This linear layout direction is set to vertical, so that each TextView control is displayed in a column. The text attribute of each TextView control is a color value, and the background color is the color. By setting the layout_width attribute of the control to fill_parent, each control is stretched to the screen width.


2. Relative layout RelativeLayout)

The basic attributes used are:

Android: layout_above: Move the control's bottom to the control with the given ID

Android: layout_below: place the top of the control under the control with the given ID

Android: layout_toLeftOf align the right edge of the control with the left edge of the control with the given ID

Android: layout_toRightOf align the left and right sides of the control with the given ID to android: layout_alignBaseline the baseline of the control and the baseline of the control with the given ID to android: layout_alignBottom compares the bottom edge of the control with the given ID

Android: layout_alignLeft: Align the left edge of the control with the given ID

Android: layout_alignRight: Align the right edge of the control with the right edge of the given ID Control

Android: layout_alignTop: aligntop

Android: alignParentBottom if the value is true, the bottom of the control is aligned with the bottom of the parent control.

Android: layout_alignParentLeft if the value is true, align the left of the control with the left of the parent control. android: layout_alignParentRight if the value is true, align the right of the control with the right of the parent control android: layout_alignParentTop if the value is true, align the top of the space with the top of the parent control android: layout_centerHorizontal if the value is true, this control will be directed to the center of the horizontal direction

Android: layout_centerInParent if the value is true, the control will be centered in the horizontal and vertical directions of the parent control. android: layout_centerVertical if the value is true, the control will be centered in the vertical direction.

Android: layout_above: Move the control's bottom to the control with the given ID

Android: layout_below: place the top of the control under the control with the given ID

Android: layout_toLeftOf align the right edge of the control with the left edge of the control with the given ID

Android: layout_toRightOf align the left and right sides of the control with the given ID to android: layout_alignBaseline the baseline of the control and the baseline of the control with the given ID to android: layout_alignBottom compares the bottom edge of the control with the given ID

Android: layout_alignLeft: Align the left edge of the control with the given ID

Android: layout_alignRight: Align the right edge of the control with the right edge of the given ID Control

Android: layout_alignTop: aligntop

Android: alignParentBottom if the value is true, the bottom of the control is aligned with the bottom of the parent control.

Android: layout_alignParentLeft if the value is true, align the left of the control with the left of the parent control. android: layout_alignParentRight if the value is true, align the right of the control with the right of the parent control android: layout_alignParentTop if the value is true, align the top of the space with the top of the parent control android: layout_centerHorizontal if the value is true, this control will be directed to the center of the horizontal direction

Android: layout_centerInParent if the value is true, the control will be centered in the horizontal and vertical directions of the parent control. android: layout_centerVertical if the value is true, the control will be centered in the vertical direction.

 

3. TableLayout)

Each row is represented by <TableRow> </TableRow>. Other controls can be placed in the same row of the table.

4. Frame layout FrameLayout)

The frame layout feature is to ensure that the page can cover other pages, such as advertisement pages in the webpage, always bounce out of the page.

This article is from the MySpace blog, please be sure to keep this source http://wangzhaoli.blog.51cto.com/7607113/1280276

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.