It most like this question:How to convert View to Bitmap in android?. And my way is:
Bitmap bitmap = null;
int viewWidth = view.getWidth();
int viewHeight = view.getHeight();
bitmap = Bitmap.createBitmap(viewWidth, viewHeight, Bitmap.Config.RGB_565);
Canvas canvas = new Canvas(bitmap);
view.draw(canvas);
return bitmap;
But there's a OutofMemory may happen in createBitmap()
, so I want to scale the bitmap's size. Like this:
bitmap = Bitmap.createBitmap(viewWidth / 4, viewHeight / 4, Bitmap.Config.RGB_565);
Now the question is:
How can I draw view to the scaled bitmap?
Thanks a lot.