GridView is a ViewGroup, It is use for set data in a tabular view. We can display items in a two-dimensional using gridview. The grid items automatically inserted to the layout using a ListAdapter. The GridView are subcolasses of AdapterView
Important attributes:
android:id - Unique Identifier
android:columnWidth - set the fixed width for each column
android:gravity - set gravity for each cell
android:horizontalSpacing - set horizontal spacing between columns
android:verticalSpacing - set vertical spacing between cell
android:numColumns - set number of columns like int value(1) or auto_fit(auto fill columns in available space)
android:stretchMode - stretch the columns in available space, we can use value for stretchMode (none, spacingWidth, columnWidth, spacingWidthUniform)
In this tutorial, you'll create a grid of image with name When an item is selected, a toast message will display the position of the item.