android - RelativeLayout to the right instead of on top -
how can create imageviews land beside eachother , not on top of eachother?
public void deckbuttononclick(view v) { imageview imageview = new imageview(getapplicationcontext()); imageview.setimageresource(deck.takecard()); imageview.setadjustviewbounds(true); imageview.setlayoutparams(params); imageview.settag("0"); imageview.setonclicklistener(new myonclicklistener()); ((relativelayout) findviewbyid(r.id.innerrelativelayout)).addview(imageview); }
thank you!
option 1: rework container cards linearlayout instead of relativelayout, using orientation="horizontal".
option 2: using relativelayout, you'll need give each imageview create id (maybe increment counter each time 1 created , append id). then, when creating params variable, can add rule align right of previous imageview.
params = new relativelayout.layoutparams(relativelayout.layoutparams.wrap_content, relativelayout.layoutparams.wrap_content); params.addrule(relativelayout.right_of, r.id.imageview1); imageview.setlayoutparams(params);
android relativelayout
No comments:
Post a Comment