Skip to main content

Posts

Showing posts with the label custom gridview with icon and text

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 ;       private ArrayList<In