LinearLayoutis a view group that aligns all children in a single direction , vertically or horizontally.
- You can specify the layout direction with the
android:orientationattribute.
Linear Layout Attributes
Following are the important attributes specific to LinearLayout −
Sr.No | Attribute & | Description |
1 | android:id
| This is the ID which uniquely identifies the layout. |
2 | android:baselineAligned
| This must be a boolean value, either "true" or "false" and
prevents the layout from aligning its children's baselines. |
3 | android:baselineAlignedChildIndex
| When a linear layout is part of another layout that is baseline aligned,
it can specify which of its children to baseline align. |
4 | android:divider
| This is drawable to use as a vertical divider between buttons.
You use a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb". |
5 | android:gravity
| This specifies how an object should position its content, on both the X and Y axes.
, Possible values are top, bottom, left, right, center, center_vertical, center_horizontal etc. |
6 | android:orientation
| This specifies the direction of arrangement and you will use "horizontal" for a row, "vertical" for a column.
The default is horizontal. |
7 | android:weightSum
| Sum up of child weight |