android tutorial - Developer android | Linear Layout in Android Layout - android app development - android studio - android app developement
Linear Layout
LinearLayout is a view group that aligns all children in a single direction, vertically or horizontally.
- One more important attribute in linear layout is Layout Weight
- LinearLayout also supports assigning a weight to individual children with the android:layout_weight attribute. This attribute assigns an "importance" value to a view in terms of how much space it should occupy on the screen.
LinearLayout Attributes
Attribute | Description |
---|---|
android:orientation | This specifies the direction of arrangement and you will use "horizontal" for a row, "vertical" for a column. The default is horizontal. |
android:weightSum | Sum up of child weight |
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. |
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". |