RelativeLayout is often used for screen layout. Some important attributes of this layout are summarized as follows:
Class 1: the property value is true or false.
Android: layout_centerHrizontal horizontal center
Android: layout_centerVertical vertical center
Android: layout_centerInparent is completely centered over the parent Element
Android: layout_alignParentBottom: attach the lower edge of the parent Element
Android: layout_alignParentLeft: Stick the left edge of the parent Element
Android: layout_alignParentRight: attaches the right edge of the parent element.
Android: layout_alignParentTop: top the parent Element
Android: layout_alignWithParentIfMissing
Class 2: the reference "@ id/id-name" www.2cto.com must be the property value of id.
Android: layout_below is under an element
Android: layout_abve is above an element.
Android: layout_toLeftOf on the left of an element
Android: layout_toRightOf on the right of an element
Android: layout_alignTop: Align the top edge of an element with the top edge of an element.
Android: layout_alignLeft: Align the left edge of an element with the left edge of an element.
Android: layout_alignBottom: the bottom edge of the current element is aligned with the bottom edge of an element.
Android: layout_alignRight: the right edge of an element is aligned with the right edge of an element.
Category 3: attribute values are specific pixel values, such as 30dip and 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 edge of an element
Category 4: Other attributes
Android: gravity limits the view content.
Android: layout_gravity is used to set the location of the view relative to the parent view.
Android: scaleType controls how images are resized/moved to match the size of ImageView. Optional values:
Center is not scaled. The center is displayed based on the original size of the image. When the length/width of the image exceeds the length/width of the View, the center part of the screenshot is displayed;
CenterCrop scales the image in the center proportionally so that the image length (width) is equal to or greater than the View length (width)
CenterInside scales the image proportionally to center display, so that the image length/width is equal to or less than the View length/width
The fitCenter scales proportionally to the width of the View and is displayed in the center.
FitEnd scales proportionally to the width of the View, which is displayed in the lower part of the View.
FitStart scales proportionally to the width of the View, which is displayed in the top part of the View.
FitXY scales proportionally to the View size.
From running snails