Relative Layout


Android RelativeLayout enables you to specify how child views are positioned relative to each other. The position of each view can be specified as relative to sibling elements or relative to the parent.
Relative Layout
Relative Layout - Android Code Tutorial




Using RelativeLayout, you can align two elements by right border, or make one below another, centered in the screen, centered left, and so on. By default, all child views are drawn at the top-left of the layout, so you must define the position of each view using the various layout properties available from RelativeLayout.LayoutParams and few of the important attributes are given below
Sr.No.Attribute & Description
1
android:layout_above
Positions the bottom edge of this view above the given anchor view ID and must be a reference to another resource, in the form "@[+][package:]type:name"
2
android:layout_alignBottom
Makes the bottom edge of this view match the bottom edge of the given anchor view ID and must be a reference to another resource, in the form "@[+][package:]type:name".
3
android:layout_alignLeft
Makes the left edge of this view match the left edge of the given anchor view ID and must be a reference to another resource, in the form "@[+][package:]type:name".
4
android:layout_alignParentBottom
If true, makes the bottom edge of this view match the bottom edge of the parent. Must be a boolean value, either "true" or "false".
5
android:layout_alignParentEnd
If true, makes the end edge of this view match the end edge of the parent. Must be a boolean value, either "true" or "false".
6
android:layout_alignParentLeft
If true, makes the left edge of this view match the left edge of the parent. Must be a boolean value, either "true" or "false".

Share this