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 imageview
s, because need recycling abilities of gridview
.
in case of gridlayout
, can create base gridlayout
, set 5 columns , use gridlayout.addview(view, layoutparams)
append new imageview
s. 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
Post a Comment