My requirement is In android I have 4 dynamic columns of images in which there shoud be a empty column after second column -


please suggest best approach follow. tried grid view not able empty column

if not want use gridview (should work fine case), use gridlayout. not advise if going have lot of imageviews, because need recycling abilities of gridview.

in case of gridlayout, can create base gridlayout, set 5 columns , use gridlayout.addview(view, layoutparams) append new imageviews. when on second column add space view.

some simple pseudocode:

for(int = 0; < imagelist.size(); i++) {     imageview imageview = getimageviewusinglist(i);      if((i % 5) % 2 == 1) {         gridlayout.addview(new space(), layoutparams);     } else {         gridlayout.addview(imageview, layoutparams);     } } 

Comments

Popular posts from this blog

php - How can an email be returned from Stripe Checkout? -

SQL php on different pages to Insert (mysqli) -

linked list - Get the index of the Node in a LinkedList which contains the given value in java -