I need to take a screenshot from a webview as a thumb, but when I use View.draw(Canvas) I only get the drawing from the top left of the website, not my currently viewing part (what the webview is showing), and also the part out of sight is blank (I know it is caused by enableSlowWholeDocumentDraw and I don't need those area anyway)
Here are the related codes (inside a class extends WebView):
public Bitmap Screenshot() {
try {
Bitmap bitmap = Bitmap.createBitmap(getMeasuredWidth(),getMeasuredHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
this.draw(canvas);
return bitmap;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}