Relative layout relativelayout, inherited from viewgroup. The position of the sub-component of the relative layout is always relative to the sibling component or parent container.
XML attributes supported by Relativelayout:
android:gravity setgravity (int): Set the alignment of the subcomponents in the container
android:ignoregravity setignoregravity (int): Sets which subcomponent is not affected by the gravity Property
Relativelayout has an internal class relativelayout.layoutparams to control how the subcomponents are laid out.
The XML attributes supported by Relativelayout.layoutparams are as follows:
First Class:Property value istrueorfalse
Android:layout_centerhrizontalCenter Horizontally
Android:layout_centerverticalCenter Vertically
Android:layout_centerinparentfully centered relative to parent element
Android:layout_alignparentbottomsnaps to the bottom edge of the parent element
Android:layout_alignparentleftsnaps to the left edge of the parent element
Android:layout_alignparentrightsnaps to the right edge of the parent element
Android:layout_alignparenttopsnaps to the top edge of the parent element
Android:layout_alignwithparentifmissingif the corresponding sibling element cannot be found, then the parent element is the reference.
Class II: The attribute value must beIDthe reference name"@id/id-name”
Android:layout_belowat the bottom of an element
Android:layout_aboveat the top of an element
Android:layout_toleftofon the left side of an element
Android:layout_torightofon the right side of an element
android:layout_aligntop Align 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 Align 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
Android Thoughts (14): Relative layout relativelayout