2 pages
Word Count
495 words
Bahaudin Zakariya Univer
Course Code
Android Development

Linear Layout

March 11, 2020
up for livestream updates.(https://developer.android.com/dev-summit)
LinearLayout(/reference/android/widget/LinearLayout.html) is a view group that aligns all
children in a single direction, vertically or horizontally. You can specify the layout direction
with the android:orientation
(/reference/android/widget/LinearLayout.html#attr_android:orientation) attribute.
Note: For better performance and tooling support, you should instead build your layout with
All children of a LinearLayout(/reference/android/widget/LinearLayout.html) are stacked one
after the other, so a vertical list will only have one child per row, no matter how wide they are,
and a horizontal list will only be one row high (the height of the tallest child, plus padding). A
LinearLayout(/reference/android/widget/LinearLayout.html) respects margins between children
and the gravity (right, center, or left alignment) of each child.
Layout Weight
Linear Layout
LinearLayout(/reference/android/widget/LinearLayout.html) also supports assigning a weight to
individual children with the android:layout_weight
(/reference/android/widget/LinearLayout.LayoutParams.html#attr_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. A larger weight value allows it to expand to fill any remaining space in
the parent view. Child views can specify a weight value, and then any remaining space in the
view group is assigned to children in the proportion of their declared weight. Default weight is
Equal distribution

Subscribe Now

Sign up to view full document

View Document