Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Display Image Caption Below Images in Gridview

Tags:

android

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!

like image 866
Tyler Avatar asked May 14 '10 23:05

Tyler


1 Answers

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.

like image 52
CommonsWare Avatar answered Sep 23 '22 16:09

CommonsWare