Android layout attributes

Source: Internet
Author: User

Android: id

Specify the corresponding ID for the control

Android: text

Specify the text displayed in the control. Note that strings in the strings. xml file should be used as much as possible here.

Android: gravity

Specifies the alignment mode of the View component. For example, the center and right positions indicate that the text position in the control is not the control itself.

Android: layout_gravity (different from: android: gravity)

Specifies the iner component alignment. for example, if a button is in linearlayout, you can set it by placing it on the left or right. take the button as an example. For android: layout_gravity = "right", the button is right-aligned.
Android: textSize

Specifies the font size in the control.

Android: background

Specifies the background color used by the control. The RGB naming method is used.

Android: width

Width of the control

Android: height

Height of the control

Android: layout_width

Specify the Container component width

Android: layout_height

Height of the Container component

Android: layout_weight

View is a very important attribute, divided by proportion of space

Android: padding *

Specifies the padding of the control, that is, the content of the control.

Android: sigleLine

If set to true, the control content is displayed in the same row.

Android: scaleType

Controls how images are resized/moved to match the size of the ImageView.

Android: layout_centerHrizontal

Horizontal Center

Android: layout_centerVertical

Vertical center

Android: layout_centerInparent

Completely centered relative to the parent Element

Android: layout_alignParentBottom

Stick the lower edge of the parent Element

Android: layout_alignParentLeft

Attach the left edge of the parent Element

Android: layout_alignParentRight

Attach the right edge of the parent Element

Android: layout_alignParentTop

Attach the upper edge of the parent Element

Android: layout_alignWithParentIfMissing

If the corresponding sibling element cannot be found, the parent element will be used as a reference object.

Android: layout_below

Below an element

Android: layout_abve

Above an element

Android: layout_toLeftOf

On the left of an element

Android: layout_toRightOf

On the Right of an element

Android: layout_alignTop

The top edge of the element is aligned with the top edge of an element.

Android: layout_alignLeft

The left edge of the element is aligned with the left edge of an element.

Android: layout_alignBottom

The bottom edge of the element is aligned with the bottom edge of an element.

Android: layout_alignRight

The right edge of the element is aligned with the right edge of an element.

Android: layout_marginBottom

Distance from the bottom edge of an element

Android: layout_marginLeft

Distance from the left edge of an element

Android: layout_marginRight

Distance from the right edge of an element

Android: layout_marginTop

Distance from the edge of an element

Android: paddingLeft

The distance between the content of the element and the right edge of the element.

Android: paddingRight

The distance between the content of the element and the edge of the element.

Android: hint

Prompt information in the input box when EditText is set to null

Android: LinearLayout

It determines the direction of LinearLayout. Its value can be vertical, indicating the vertical layout of horizontal, indicating the horizontal layout.

 

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.