Tablelayout table layout of Android layout
The tablelayout class manages controls in the form of rows and columns. Each row is a tablerow object or a view control. When it is a tablerow object, you can add child controls under the tablerow. By default, each child control occupies a column. When it is a view, the view will monopolize one row.
Three common attributes
Android: columnsecolumns: sets the ordinal number of the column to be hidden
Android: shrinkcolumns: sets the column ordinal of columns that are allowed to be shrunk
Android: stretchcolumns: sets the column ordinal of the stretched column to run
Learning map
(1) Introduction to tablelayout
Tables are often used in Java swing programming and HTML. It can be seen that tables are often used in application development. Similarly, Android also provides us with such a layout.
(2) How to determine the number of rows
A: directly to the tablelayout component, directly occupying one line
B: if you want to add multiple components in a row, you need to add them in tablerow
C: how many components are there in a tablerow, and how many columns are there in this row
(3) Three common attributes (all counting from zero)
Shrinkable: if a column is set to shrinkable, the width of all cells in the column can be shrunk to ensure that the table can adapt to the width of the parent container;
Stretchable: if a column is set to stretchable, the width of all cells in the column can be stretched to ensure that the components completely fill the empty space of the table;
Collapsed: if a column is set to collapsed, the of all cells in the column will be hidden;
(4) Use instance (to demonstrate the effect, all components have no ID set)
The above content is the tablelayout table layout of Android layout introduced by Xiaobian. I hope you like it.