Android Bitmap from visible area of scrollview -
i have static helper method takes view , returns bitmap of view. (the real method modifies bitmap before returning it).
public static bitmap getbitmapfromview(view targetview) { bitmap bitmap = bitmap.createbitmap( targetview.getwidth(), targetview.getheight(), bitmap.config.argb_8888); canvas canvas = new canvas(bitmap); targetview.draw(canvas); .... return bitmap; }
i'd modify special case of when targetview scrollview. i'd grab section of scrollview visible instead of whole scrollview. can't seem come examples.
calling getdrawingcache()
on targetview
might possible solution:
if (targetview instanceof scrollview) { targetview.setdrawingcacheenabled(true); bitmap = targetview.getdrawingcache(); }
Comments
Post a Comment