Skip to main content

Posts

Showing posts with the label custom gridview

Custom Grid View in Android/Grid View with icons and text/GridView example in android

Custom Grid View in android /Grid View with icons and text/GridView example in android Here, I am going to develop an application that displays icon with text as grid view.   In previous example, I showed you to create grid view with icons. In that case, only one xml is used to display the images. In case of custom grid view, you need to create two xml one for gridview and other for icon and text. After that we can inflate these two xml on your activity to create custom grid view CustomGridViewActivity.java package com.example; import java.util.ArrayList; import android.app.Activity; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.GridView; import android.widget.ImageView; import android.widget.TextView; public class CustomGridViewActivity extends Activity {     private ArrayList<String> textfield ;  ...

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 gr...