tags:

views:

336

answers:

2

Hello -

I am utilizing a version of the "Grid View" example from the Android Developers site:

http://developer.android.com/resources/tutorials/views/hello-gridview.html

And I would like to display a small text caption below each of the images.

Can someone please give an example of how this might be accomplished (i.e. what needs to be edited)?

Thanks!

+1  A: 

Instead of an ImageAdapter returning ImageViews from getView(), you would need a TylerAdapter returning a LinearLayout or RelativeLayout for each cell, with the layout containing your ImageView and TextView caption.

Here is a free excerpt from one of books that illustrates stuff like this, albeit in the context of a ListView instead of a GridView. Those are both AdapterViews, and so the techniques are nearly identical.

CommonsWare
Thank you, however I am afraid I am still having trouble.. The example you gave me makes sense, but they use "SetListAdapter" which allows you to pass a layout to it, but since I am trying to use gridview, I cannot seem to figure out how to accomplish the same. Are you able to illustrate it better for me by any chance?
Tyler
A: 

After looking around some more, I found a great example of exactly how to do this here:

http://mytelcoit.com/2010/02/programming-android-create-icon-with-text-using-gridview-and-layout-inflater/

Tyler