Common obfuscation properties for Android layouts

Source: Internet
Author: User

1. How do you control the relative position of a control in a parent control?

Layout_margin is provided in the Android system to control the margins of a control's edge relative to the parent control.

which

Android:layout_margintop represents the distance that a control is relative to the top of the parent control.

Android:layout_marginleft represents the distance of a control relative to the left border of the parent control.

Android:layout_marginright represents the distance of a control relative to the right border of the parent control.

Android:layout_marginbuttom represents the distance from the bottom of a control relative to the parent control.

2. How do you control the relative position of content in a control in the control?

Padding is provided in the Android system to control the margins of content in a control relative to the edge of the control.

which

Android:paddingtop represents the distance of content in a control relative to the top of the edge of the control.

Android:paddingleft represents the distance of content in a control relative to the left edge of the control.

Android:paddingright represents the distance of content in a control relative to the right edge of the control.

Android:paddingbuttom represents the distance of content in a control relative to the bottom of the control's edge.

3. The difference between android:gravity and android:layout_gravity

The android:gravity is used to set the alignment of the view component, and android:layout_gravity is used to set the alignment of the container component.

For example, Button:

Android:gravity: Indicates the position of the word above the button in the button,

Android:layout_gravity: Represents the position of the button on the interface.

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.