Skip to main content

RelativeLayout

Overview

RelativeLayout positions controls using relative positioning — placing them relative to other controls or the parent container. When designing relative layouts, follow dependency relationships between controls; controls added later depend on those added earlier.

Example

 <RelativeLayout
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="match_parent">
</RelativeLayout>

Properties

Common Properties

See Common Properties

Private Properties

PropertyDescriptionValues
layout_weightChild weightNumber
When the parent is LinearLayout, child controls can set weight
gravityInternal control alignmentUsage reference
top
bottom
left
right
center_vertical
fill_vertical
center_horizontal
fill_horizontal
center
fill
clip_vertical
clip_horizontal