Differences between Android: paddingleft and layout_marginle Android: layout_gravity and Android: gravity

Source: Internet
Author: User

Summary:

Android: paddingleft: indicates how much space is reserved in this control.

Android: layout_marginleft: the size of the control to the space of the parent control.


 

<Linearlayout <br/> Android: layout_height = "28px" <br/> Android: layout_width = "fill_parent" <br/> Android: orientation = "horizontal" <br/> Android: gravity = "center_vertical" <br/> Android: paddingleft = "25px" <br/> Android: background = "@ drawable/top_bg" <br/> <imageview <br/> Android: layout_width = "18px" <br/> Android: layout_height = "18px" <br/> Android: src = "@ drawable/manage" <br/> </imageview> <br/> <textview <br/> Android: layout_width = "wrap_content" <br/> Android: layout_height = "wrap_content" <br/> Android: textcolor = "#000" <br/> Android: textsize = "14px" <br/> Android: TEXT = "application" <br/> </textview> <br/> </linearlayout> </P> <p>

Android: paddingleft: indicates how much space is reserved in this control.

 

 

<Linearlayout <br/> Android: layout_height = "28px" <br/> Android: layout_width = "fill_parent" <br/> Android: orientation = "horizontal" <br/> Android: gravity = "center_vertical" <br/> Android: layout_marginleft = "25px" <br/> Android: background = "@ drawable/top_bg" <br/> <imageview <br/> Android: layout_width = "18px" <br/> Android: layout_height = "18px" <br/> Android: src = "@ drawable/manage" <br/> </imageview> <br/> <textview <br/> Android: layout_width = "wrap_content" <br/> Android: layout_height = "wrap_content" <br/> Android: textcolor = "#000" <br/> Android: textsize = "14px" <br/> Android: text = "app" <br/> </textview> <br/> </linearlayout>

 

Android: layout_marginleft:

It refers to the space of the control to the parent control.

Gravity is the center of gravity, which indicates the position of the stop.

Differences between Android: layout_gravity and Android: gravity

From the name, we can see that Android: gravity refers to the element itself, and the text of the element itself is displayed in any place by changing the attribute settings, but not set to the left by default.

Android: layout_gravity is relative to its parent element, indicating where the element is displayed.

For example, "button: Android: layout_gravity" indicates the position of the button on the interface. Android: gravity indicates the position of the word on the button.

 

Related Article

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.