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

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -