android - How to add image in table row programmatically? -
i developing android app. need populate list images. want insert image in table layout row row using array. can guide me how it? thank you.
use code , make changes according code
tablelayout table = new tablelayout(this); (int = 0; < mrows; i++) { tablerow tr = new tablerow(mcontext); tr.setlayoutparams(new tablerow.layoutparams(layoutparams.fill_parent, layoutparams.wrap_content)); (int j = 0; j < mcols; j++) { imageview view = new imageview(this); view.setimageresource(r.drawable.star_on) tr.addview(view); } table.addview(tr); }
Comments
Post a Comment