Difference between Linear Layout And Relative Layout


Difference between Linear And Relative Layout:

RELATIVE LAYOUT:
Every element of relative layout arranges itself to the other element or a parent element.
It is helpful while adding views one next to other etc
In a relative layout you can give each child a Layout Property that specifies exactly where it should go in relative to the parent or relative to other children.
Views can be layered on top of each other.

LINEAR LAYOUT:
In a linear layout, like the name suggests, all the elements are displayed in a linear fashion either vertically or horizontally.
Either Horizontally or Vertically this behavior is set in android:orientation which is an property of the node Linear Layout.
android:orientation=”horizontal”  or android:orientation=”vertical”
Linear layouts put every child, one after the other, in a line, either horizontally or vertically

Post a Comment

0 Comments