Tyler
Tyler

Reputation: 31677

Android - Display Image Caption Below Images in Gridview

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!

Upvotes: 7

Views: 15910

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007584

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.

Upvotes: 6

Related Questions