java - Is it possible to create a bitmap, add it to canvas and draw it using view.draw? -
for example ..
bitmap mypic = bitmapfactory.decoderesource(getresources(), r.drawable.ic_launcher); bitmap newpic = bitmap.createscaledbitmap(mypic, 50, 50, true); canvas mycanv = new canvas(newpic); view myview = (view)findviewbyid(r.id.view1); myview.draw(mycanv);
is above feasible?
you shouldn't that. recommendation this
bitmap mypic = bitmapfactory.decoderesource(getresources(), r.drawable.ic_launcher); mypic = bitmap.createscaledbitmap(mypic,50,50, true); bitmapdrawable draw = new bitmapdrawable(this.getresources(), mypic); view myview = (view) findviewbyid (r.id.view1); myview.setbackground(draw);
this way pass view
drawable background. if want set bitmap
source should make imageview
Comments
Post a Comment