Android Layout Properties Detailed anatomy

Source: Internet
Author: User

The layout of the view is displayed in the following ways:

Linear layout (LinearLayout)

Relative layout (relativelayout)

Table Layout (tablelayout)

Grid view (GridView)

Label layout (tablayout)

List view (ListView)

Absolute Layout (absolutelayout)

In this paper, we mainly describe some parameter values. Some of the important attributes that Relativelayout uses:

First Class: Property value is True or False

Android:layout_centerhrizontal Horizontal Center

Android:layout_centervertical Vertical Center

Android:layout_centerinparent is completely centered relative to the parent element

Android:layout_alignparentbottom snaps to the bottom edge of the parent element

Android:layout_alignparentleft snaps to the left edge of the parent element

Android:layout_alignparentright snaps to the right edge of the parent element

Android:layout_alignparenttop snaps to the top edge of the parent element

android:layout_alignwithparentifmissing if the corresponding sibling element cannot be found, then the parent element is the reference.

Second class: The attribute value must be the reference name of the id "@id/id-name"

Android:layout_below at the bottom of an element

Android:layout_above at the top of an element

Android:layout_toleftof on the left side of an element

Android:layout_torightof on the right side of an element

Android:layout_aligntop aligns the top edge of this element with the top edge of an element

Android:layout_alignleft aligns the left edge of this element with the left edge of an element

Android:layout_alignbottom aligns the bottom edge of this element with the bottom edge of an element

Android:layout_alignright aligns the right edge of this element with the right edge of an element

Class III: Attribute values are specific pixel values, such as 30dip,40px

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 top edge of an element

EditText the Android:hint setting EditText is empty when the message is in the input box.

Android:gravity

The Android:gravity property is the qualification for the view content.  For example, a button above the text. You can set the text on the left side of the view, on the right, and so on. Take the button as an example, android:gravity= "right" then the text on the button

Android:layout_gravity

Android:layout_gravity is used to set the position of the view relative to the parent view. For example, a button in the LinearLayout, you want to put the button on the left, right and other positions can be set by this property. Take button For example, android:layout_gravity= "right" button on

Android:layout_alignparentright

Aligns the right end of the current control with the right end of the parent control. This property value can only be true or FALSE, which is false by default.

Android:scaletype:

Android:scaletype is a size that controls how the picture resized/moved to the ImageView. The meaning difference of Imageview.scaletype/android:scaletype value:

Center/center is centered on the original size of the image, and when the picture is longer/wider than the length/width of the view, the center portion of the image is displayed

Center_crop/centercrop proportionally enlarges the size of the image so that the image is long (wide) equal to or greater than the length (width) of the view

Center_inside/centerinside Displays the contents of the picture in full, by scaling it down or the original size to make the picture long/wide equal to or less than the length/width of the view

Fit_center/fitcenter enlarge/Shrink the picture to the width of the view, centered on the display

Fit_end/fitend Zoom in/out to the width of the view, displayed in the lower part of the view

Fit_start/fitstart enlarge/Shrink the image to the width of the view, displayed in the upper part of the view

Fit_xy/fitxy The picture is not scaled up/down to the view size display

The Matrix/matrix is drawn with a matrix and is displayed by zooming in and out of the image.

Note that the name of the image in the Drawable folder cannot be capitalized.

Android Layout Properties Detailed anatomy

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.