Android Question xClv with Four Columns of ImageViews but the Number of Images is not Divisible by Four

Mahares

Expert
Licensed User
Longtime User
I download a Json string composed of a list of maps. Each map has the name of the image and the folder of the image location. There are 11 images from a web site to display on an xClv as 4 columns of image views in each panel. Since 11 is not divisible by 4, the way I got it working is to create a fake map and add it to the list of maps to make a list of 12 maps, but it seems like there is a lot better way to display 11 images in 3 rows of 4 image views. The final image view will have no image. Can someone tell me how you would handle an odd number of items and have an xClv with multiple rows and 4 columns.
Thank you
 

Mahares

Expert
Licensed User
Longtime User
In this example I have a list of 11 images, so I added 1 fictitious map to the list to make it a list with 12 items. But, if I have 10 images, I add 2 maps and if I have 9 images I add 3 maps based on list.size mod number of columns. Is that still an acceptable approach.
 
Upvote 0
Top