android - Add imageview to layout -


i want create image view code , add layout...but l don't use in-code setup layout.i have relativelayout in xml , use setcontentview(r.layout.activity_game); how add imageview layout?

relativelayout rl = (relativelayout)findviewbyid(r.id.id_of_your_relative_layout_here); imageview iv = new imageview(this) iv.setimageresource(r.drawable.some_drawable_of_yours); //or iv.setimagedrawable(getresources().getdrawable(r.drawable.some_drawable_of_yours)); rl.addview(iv); 

Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

jquery - How would i go about shortening this code? And to cancel the previous click on click of new section? -