Android Beginner's layout properties

Source: Internet
Author: User

1, relative to an element, the use of "@id/***"

Android:layout_toleftof on the left side of an element

Android:layout_torightof on the right side of an element

The android:layout_below is below an element.

Android:layout_above on top of an element

2, relative to an element, the use of "@id/***"

Android:layout_aligntop aligns the upper end of the current element with the upper end of an element

Android:layout_alignleft the left of the current element aligns with the left of an element

Android:layout_alignright aligns the right end of the current element with the right end of an element

Android:layout_alignbottom The lower end of the current element aligns with the lower end of an element

3, use to set specific values, such as 30DP

Android:layout_marginleft external distance left distance

Android:layout_margintop distance from the top of the outer distance

Android:layout_marginright External distance Right distance

Android:layout_marginbottom external distance from bottom edge

Android:layout_margin If the direct margin is the outside distance around the distance

4, use to set specific values, such as 30DP

Distance from top of android:paddingtop interior

Android:paddingleft interior distance left distance

Android:paddingright Interior distance Right distance

Android:paddingbottom internal distance from bottom

android:padding internal distance from the surrounding distance

5.

android:gravity="left" text

The difference between android:gravity and android:layout_gravity

The Android:gravity property is the qualification for the content in the view. For example, a button above the text. You can set the text relative to the view's left, right, and so on.
Android:layout_gravity is used to set the location of the view relative to the parent view. For example, a button in the LinearLayout, you want to put the button in the LinearLayout left, on the right and so on can be set by this property.

6.

7.

8.

Android Beginner's layout properties

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.