Linear Layout-linearlayout
- Linear la s do not wrap lines. When a component is arranged to the header, the remaining components are not displayed.
- Two most important attributes in linear Layout
Android: Orientation sets the arrangement of components in the layout manager.
Horizontal: horizontal vertical: vertical
Android: gravity sets the alignment of components in the layout manager.
Top | bottom | left | right | center_vertical | center_horizontal | center |...
- Multiple Attribute values in the Android: gravity attribute can be separated by vertical bars.
View Code <? XML version = "1.0" encoding = "UTF-8"?>
<Linearlayout xmlns: Android = "http://schemas.android.com/apk/res/android"
Android: layout_width = "match_parent"
Android: layout_height = "match_parent"
Android: Orientation = "vertical"
Android: gravity = "center | left">
<Button
Android: layout_width = "80dp"
Android: layout_height = "wrap_content"/>
<Button
Android: layout_width = "80dp"
Android: layout_height = "wrap_content"/>
<Button
Android: layout_width = "80dp"
Android: layout_height = "wrap_content"/>
<Button
Android: layout_width = "80dp"
Android: layout_height = "wrap_content"/>
<Button
Android: layout_width = "80dp"
Android: layout_height = "wrap_content"/>
<Button
Android: layout_width = "80dp"
Android: layout_height = "wrap_content"/>
</Linearlayout>