Usage of gravity and weight metric data in Android

Source: Internet
Author: User

Android: gravity is used to set the alignment of child controls in the control;
Android: layout_gravity is used to set the alignment of the control in its parent control.

See: http://byandby.iteye.com/blog/1020374

Gravity indicates gravity, that is, the position of the control along the horizontal or vertical direction;
Weight indicates the weight and weight, that is, the proportion of the space occupied by the current control in the canvas.
Of course, the larger the weight value, the larger the space occupied by the control. It is mainly used to set the display ratio of the page control.

 

The main parameters are as follows:
Android: layout_weight = ""
Android: layout_gravity = ""
Android: gravity = ""

 

Example:

Android: layout_weight = "1"
Android: gravity = "center"

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.