Skip to main content

Posts

Custom gridview/Grid View with icons/Grid View in Android/ Grid View with image

Custom gridview/Grid View with icons/ Grid View in Android/ Grid View with image Grid View with icons can be done using Base Adapter. Before start coding, collect some images and copy it into the resource folder.  Create a new project In the main . xml file, add the grid view <? xml version = "1.0" encoding = "utf-8" ?> <GridView xmlns:android = "http://schemas.android.com/apk/res/android"      android:id = "@+id/gridview"      android:layout_width = "fill_parent"      android:layout_height = "fill_parent"      android:columnWidth = "90dp"      android:numColumns = "auto_fit"      android:verticalSpacing = "10dp"      android:horizontalSpacing = "10dp"      android:stretchMode = "columnWidth"      android:gravity = "center" /> In the activity, create an object of grid view as we did in previous example. (Grid View with text). Then gridview . setAdapter

Grid View in Android/Grid View Example in android/ Simple grid View in android

Grid View with text in android /Grid View Example in android/ Simple grid View in android Using grid View we can display items in two dimensional, scrollable grids. Grid view can be used in many ways. We can display text using grid view (very simple when compared to other grid view). First create a project and name it as you like. Then go to the main.xml file (I think you may now familiar with xml and other application resource stuffs). Then open the graphic layout, select composite and drag “Grid View” in to the page. Quite simple, right?? The code look like this.. <GridView xmlns:android = "http://schemas.android.com/apk/res/android"     android:id = "@+id/gridView1"     android:numColumns = "auto_fit"     android:gravity = "center"     android:columnWidth = "50dp"     android:stretchMode = "columnWidth"     android:layout_width = "fill_parent"     android:layout_height = "fill_parent" > </Grid