Pages Navigation Menu

Coding is much easier than you think

Relative layout in android

Relative layout in android

 

 

Relative layout, in general is used to organize elements based on their relationships with one another, and with the parent container. The arrangement of the views can be done using the 3 ways,

  • Relative To Container
  • Relative To Other Elements
  • Alignment With Other Elements

Relative to Container

  • android:layout_alignParentBottom -€“ Places the bottom of the element on the bottom of the container
  • android:layout_alignParentLeft -€“ Places the left of the element on the left side of the container
  • android:layout_alignParentRight -€“ Places the right of the element on the right side of the container
  • android:layout_alignParentTop -€“ Places the element at the top of the container
  • android:layout_centerHorizontal -€“ Centers the element horizontally within its parent container
  • android:layout_centerInParent -€“ Centers the element both horizontally and vertically within its container
  • android:layout_centerVertical -€“ Centers the element vertically within its parent container

Relative to Other Elements

  • android:layout_above – Places the element above the specified element
  • android:layout_below -€“ Places the element below the specified element
  • android:layout_toLeftOf -€“ Places the element to the left of the specified element
  • android:layout_toRightOf –€“ Places the element to the right of the specified element

Alignment with Other Elements

  • android:layout_alignBaseline – Aligns baseline of the new element with the baseline of the specified element
  • android:layout_alignBottom -€“ Aligns the bottom of new element in with the bottom of the specified element
  • android:layout_alignLeft -€“ Aligns left edge of the new element with the left edge of the specified element
  • android:layout_alignRight -€“ Aligns right edge of the new element with the right edge of the specified element
  • android:layout_alignTop -€“ Places top of the new element in alignment with the top of the specified element

About Gokul


I am very much interested in android and Wicket framework. A core android developer and working in android native app development and responsive web mobile design. I have also worked in wicket fame work and java web development. I will keep on updating you about android and wicket framework and answer your query.