Android perception (14): RelativeLayout
Relative layout: RelativeLayout, inherited from ViewGroup. The position of child components in relative layout is always determined by the sibling component or parent container.
XML attributes supported by RelativeLayout:
Android: gravity setGravity (int): sets the alignment of sub-components in the container.
Android: ignoreGravity setIgnoreGravity (int): sets which sub-component is not affected by the gravity attribute.
RelativeLayout has an internal class RelativeLayout. LayoutParams to control the layout of child components.
RelativeLayout. LayoutParams supports the following XML attributes:
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 property value must be the reference name "@ id/id-name" of the 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