Grid layout: GridLayout
I personally feel that the design of GridLayout is not very perfect, each grid size, determined by the filling of the cell, that is, the default is wrap is easy for the entire gridlayout beyond the screen. Here is an example:
<?xml version= "1.0" encoding= "Utf-8"?>
<gridlayout xmlns:android= "Http://schemas.android.com/apk/res/android"
Android:layout_width= "Match_parent"
android:layout_height= "Match_parent"
android:orientation= "Vertical"
Android:RowCount= "4"
Android:ColumnCount= "2" > <!--Design 4x2 table--
<imageviewandroid:layout_row= "0"
android:layout_column= "1"
Android:scaletype= "Fitcenter"
android:src= "@drawable/png02"/> <!--you can specify where to place-
<imageviewandroid:layout_row= "1"
android:layout_column= "0"
Android:scaletype= "Fitcenter"
android:src= "@drawable/png04"/>
<imageviewandroid:layout_row= "2"
android:layout_column= "1"
Android:scaletype= "Fitcenter"
android:src= "@drawable/png08"/>
<imageviewandroid:layout_row= "3"
android:layout_column= "0"
Android:scaletype= "Fitcenter"
android:src= "@drawable/png18"/>
</GridLayout>
The flexible expense of gridlayout is that you can specify the location of the view mode and run some issues without placing content, such as the example above. Both the line number and the column number are calculated starting at 0. In addition, if a cell needs to occupy multiple locations, it can be set using Android:layout_rowspan and Android:layout_columnspan.
The biggest problem with GridLayout is that the space occupied by the entire table is indeterminate, and the line spacing is determined by the height of the largest cell in the row, which is determined by the cell with the widest range of columns. In the above example, some of the controls are outside the screen. The size of each cell defaults to wrap_content, and if we set it to match_parent, the size of the cell is the full screen.
RELATED Links: My Android development related articles
"Turn" Pro Android Learning Note (28): User interface and Control (+): GridLayout