/**
* 屏幕捕捉全屏
*/
public static Bitmap capture(Activity activity) {
activity.getWindow().getDecorView().setDrawingCacheEnabled(true);
Bitmap bmp = activity.getWindow().getDecorView().getDrawingCache();
return bmp;
}
对activity进行抓屏
/**
* 对WebView进行截图
*
* @param webView
* @return
*/
public static Bitmap captureWebView(WebView webView) {//可执行
Picture snapShot = webView.capturePicture();
Bitmap bmp = Bitmap.createBitmap(snapShot.getWidth(),
snapShot.getHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bmp);
snapShot.draw(canvas);
return bmp;
}
对webview进行抓屏