WebView的截屏主要有两种实现方式:
方式1:
bitmap = webView.getDrawingCache();
可是,webView必需要mWebView.setDrawingCacheEnabled(true);
此方式仅仅能截取屏幕显示的内容
方式2:
Picture snapShot = webView.capturePicture();
bitmap = Bitmap.createBitmap(snapShot.getWidth(),snapShot.getHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
snapShot.draw(canvas);
此方式能够将webview全部内容都进行截取。