-1

There is a scenario where I have to create a Custom ListView. What does the Custom ListView contains?

One TextView, One Thumnail, a list of images that will be added during the runtime.

Let me provide with the screenshot for better understanding:-enter image description here

In the second list item we can see that there are 3 images that has been added to this list item during the run time.

Now my question is that how can I load the list of images during the runtime? I am confused and got stuck on it.

Please help.

Thanks in advance!!!

Kanishka Sen
  • 205
  • 2
  • 9
  • 3
    I think in the first item the container (maybe LinearLayout) for the three images is hidden. And in the second item the container is set to visible. The visibility is managed in the adapter. For handling the clicks, use a OnClickListener. – PatrickMA Oct 14 '15 at 07:12
  • for run time image loading via url you can use lazy loading (like Picasso lib,Glide lib etc) Or check this http://stackoverflow.com/questions/541966/lazy-load-of-images-in-listview – Chandra Sharma Oct 14 '15 at 08:09

3 Answers3

1

You can add the GridView inside your ListView item xml and set the visibility inside adapter class accordingly.

Jas
  • 3,207
  • 2
  • 15
  • 45
1

I think the best option you have is use Picasso library here.. You don't have to think too much , just try it.

This Why use Android Picasso library to download images? says everything.

Community
  • 1
  • 1
Subin Chalil
  • 3,531
  • 2
  • 24
  • 38
0

You need to create an adapter to manage the ListView. In the adapter in getView() method, implement the following pseudo code:

LinearLayout vertical = new LinearLayout(context); //context is usually from parent
LinearLayout events = new LinearLayout(context);
LinearLayout imageList = new LinearLayout(context);

events.add(thumbnail);
events.add(name);
imageList.add(image1);
imageList.add(image2);// and so forth

vertical.add(events);
vertical.add(imageList);

return vertical;

getView() requires a View as return datatype, so whatever you return it will be displayed on the list view as a single item. You have to relate the return items to the position somehow.

This answer would be more detailed if you provide some initial code.