Android Relative Layout Common Properties

Source: Internet
Author: User

Some of the important attributes used by Relativelayout

    First Class: property value is true or false 
    android:layout_centerhrizontal  Horizontal Center  
     android:layout_centervertical   vertically centered  
    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 is not found, the parent element is the reference  

    the second Class property value must be the reference name of the id "@id/id-name"  
    android:layout_below         at the bottom of an element;
    android:layout_above      &NBSP 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   the top edge of this element and the top edge of an element are aligned  
    android: layout_alignleft  the left edge of this element and the left edge of an element are aligned  
    Android:layout_alignbottom The bottom edge of this element and the bottom edge of an element are aligned  
    android:layout_alignright  the right edge of this element and the right edge of an element are aligned  

    the third class attribute values are specific pixel values such as 30dip40px 
    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's Android:hint

Sets the prompt information in the input box when EditText is empty.

android:gravity
The Android:gravity property is a restriction on the view content, such as the text above a button. You can set the text in the left-to-right position of the view with 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 such as a button in linearlayout you want to put the button on the left, On the right, you can use this property to set the button as an example android:layout_gravity= "right" button

Android:layout_alignparentright

Aligns the right end of the current control with the right end of the parent control. The property value can only be true or false by default.

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

Center/center is centered on the original size of the picture when the picture's length/width exceeds the length/width of the view, and the center portion of the image is displayed

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

Center_inside/centerinside the contents of the picture in a full center display by scaling down or the original size so that the picture length/width is equal to or less than the length/width of the view

Fit_center/fitcenter enlarge/Shrink the image to the width of the view center display

Fit_end/fitend enlarge/Shrink the picture to the width of the view in the lower part of the view

Fit_start/fitstart enlarge/Shrink the picture to the width of the view in the upper part of the view

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

Matrix/matrix use a matrix to draw a dynamic zoom-out image to display.


Android Relative Layout Common 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.