Adding labels/text to Android Gridview

12,916

Solution 1

You can create Custom GridView as like in ListView we define Custom Layout to show the ListRow you also can create Custom Layout for the GridView Item See this Example For GridView.

Using the simple GridView You can just show one ImageView as you are doing right now, Now If you want to add another View (text) with each Grid Item, You will have to create one XML file to containing a TextView and ImageView.

Then use that XML file in the Adapter and in the GetView method you can set Image and Text to your view.

Here is another example for the same And here is another Good Example .

Solution 2

for Exaample take a LinearLayout and add a imageview , textview and inflate that layout and assingn to convertview .

Share:
12,916
user836200
Author by

user836200

Updated on June 04, 2022

Comments

  • user836200
    user836200 almost 2 years

    Is there a way to add a text label to an android gridview? I'm using the standard android example, Hello GridView.

    For instance, if I wanted to add an image title below each of the images, is there a way to do this? If so, could someone explain how this would work? Or, are there alternative ways to implement this? Thanks!