GridView layout in one of the most useful layouts in android. Gridview is mainly useful when we want show data in grid layout like displaying images or icons. This layout can be used to build applications like image viewer, audio or video players in order to show elements in grid manner.
1). Create a new project by going to File ⇒ New Android Project and fill required details.
2). Prepare your images which you want to show in grid layout and place them in res ⇒ drawable-hdpi folder.
3).Create a new XML layout under layout and name it as
1). Create a new project by going to File ⇒ New Android Project and fill required details.
2). Prepare your images which you want to show in grid layout and place them in res ⇒ drawable-hdpi folder.
3).Create a new XML layout under layout and name it as
<?xml version="1.0" encoding="utf-8"?>
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/grid_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:numColumns="auto_fit"
android:columnWidth="90dp"
android:horizontalSpacing="10dp"
android:verticalSpacing="10dp"
android:gravity="center"
android:stretchMode="columnWidth" >
</GridView>