Linear Layout
Linearlayout is a linear layout control. Its child controls are arranged horizontally or vertically.
Two attributes commonly used by linearlayout
Android: Orientation = "vertical" ---- This attribute determines the layout of its subclass control (vertical: vertical; Horizontal: horizontal)
Android: gravity = "center" ---- This attribute determines the position of its subclass XY.
Common attribute values:
Center_vertical: center vertical (Y axis)
Center_horizontal: center horizontally (X axis)
Center: center horizontally and vertically
Right: The subclass control is located on the right of the current layout.
Left: The subclass control is located on the left of the current layout.
Bottom: The subclass control is located under the current layout
Gravity attributes can be used in multiple levels, for example, Android: gravity ="Bottom | Center"
Attributes commonly used by subclass controls in linearlayout
Android: layout_gravity = "bottom" ---- indicates the position of xy in the current parent class container.
Android: layout_weight = "1" ---- indicates the proportion of controls in the current parent container.
Relative Layout
Relativelayout is a relative layout control. Its child controls are arranged in the form of relative positions between controls or the positions of subclass controls relative to parent class containers.
Frame layout framelayout
In this layout, all child elements cannot be specified to be placed, they are all placed in the upper left corner of the area, and the child elements behind them directly overwrite the child elements above the area, blocks all parts of the child element.
Absolute Layout
Absolutelayout can also be called a coordinate layout. It can directly point to the absolute position (xy) of the stator element)
Mobile phone screen sizes vary greatly
The adaptability to absolute positioning is poor, and there are major defects in screen adaptation.
Attributes of the absolutelayout sub-control
Android: layout_x = "35dp" ---- controls the X position of the control of the current subclass.
Android: layout_y = "40dp" ---- controls the Y position of the control of the current subclass.
Table Layout
The tablelayout table layout model manages child controls in the form of columns. Each row is a tablerow object. Of course, it can also be a view object.
Tablelayout attributes (Global attributes)
Android: collapsecolumns = "1, 2"
Hide index columns starting from 0. Columns must be separated by commas: 1, 2, 5
Android: shrinkcolumns = "1, 2"
Shrink index columns starting from 0. If the size of a column that can be shrunk is too large (too much content), the column must be separated by commas (,). You can also use "*" to shrink all columns. Note that a column can both shrink and stretch.
Android: stretchcolumns = "1, 2"
Stretch the index column starting from 0 to fill up the remaining blank space. The columns must be separated by commas. You can also use "*" instead of stretching all columns, note that a column can both shrink and stretch.
Local attributes of tablelayout (attributes used by internal controls)
Android: layout_column = "1" ---- the control is displayed in the second column
Android: layout_span = "2" ---- the control occupies two columns.
Five layout Modes