我想截取我的WebView截图,然后在x,y,w,h裁剪它。这是我得到的:
private WebView mWebView;
public void onSavePhoto(int top, int left, int width, int height){
Bitmap bitmap = Bitmap.createBitmap(mWebView.getWidth(), mWebView.getHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
mWebView.draw(canvas);
}
答案 0 :(得分:2)
private WebView mWebView;
public void onSavePhoto(int top, int left, int width, int height){
Bitmap bitmap = Bitmap.createBitmap(mWebView.getWidth(), mWebView.getHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
mWebView.draw(canvas);
// crop bitmap:
Bitmap croppedBitmap = Bitmap.createBitmap(bitmap, left, top, width, height);
}
答案 1 :(得分:0)
您可以执行以下步骤