Android Application Development Foundation _UI

Source: Internet
Author: User

2.2 Common UI Layouts

The layout itself cannot display any data, it can contain some sub-views, and control the layout of the child view

Common layout

    • LinearLayout

    • Relativelayout

    • Framelayout

    • ListView (later)

    • The GridView (later speaking)

2.2.1 LinearLayout

Linear layout: Used to control its sub-view to expand the display horizontally or vertically

Important attributes:

Orientation (direction)

Layout_weight (weight)

Understanding LinearLayout Weights

Value of layout_weight (weight)

    • =0 (default): Specifies how much space to occupy

    • >0: Splits the free space in the parent view, the larger the value, the greater the proportion of the occupied

Layout_weight Usage Scenarios

    • Divide the width or height of a layout evenly into equal portions

    • Occupy all the space in the center vertically or occupy all the space in the horizontal direction

2.2.2 Relativelayout

Relative layout: Used to control the layout display of its sub-view in a relatively positioned way

Relative layout is the most flexible, most powerful, and the most difficult to learn layout

Relative layout-related properties are more:

    • Sibling views: aligned in the same direction, aligned in the opposite direction

    • Between the parent view: Align in the same direction, centered

2.2.3 Framelayout Frame layout of each sub-view represents a picture, by default, the upper-left corner of the screen as (0,0) coordinates, by the definition of the order by screen display, followed by the previous screen will be covered, through the child view of the Android:layout_ Gravity property to specify the location of the child view

2.3 Common View Label properties

Partitioning of attributes

Properties for any view

Common most basic properties

Padding properties

Padding Margin Properties

Margin is only for relativelayout properties

Inverse Direction Alignment Property

To/above/below the same Direction alignment property

Align properties relative to parent view

Alignparent/center only for LinearLayout properties

Weight attribute Weight

Direction attribute Oritation


Common basic Properties

Inner margin and margins

Relative sibling view positioning

Relative Parent View Positioning

Android Application Development Foundation _UI

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.