0
我得到一个功能只能截屏可见的屏幕,没有采取完整的WebView截图。Android - 无法获取完整页面WebView截图
它不会给隐藏或滚动的内容,只是捕捉当前视图。
这是我的代码。
public File getBitmapFromwebchartView(WebView view2) {
if (view2 != null) {
view2.setDrawingCacheEnabled(true);
Bitmap b = view2.getDrawingCache();
if (b != null) {
try {
//File fi = new File(Environment.getExternalStorageDirectory(), "Screenshot" + ".jpg");
fi = new File(Environment.getExternalStorageDirectory(),"Realitycheck" + ".jpg");
// write the bytes in file
FileOutputStream fo;
fo = new FileOutputStream(fi);
b.compress(CompressFormat.JPEG, 100, fo);
} catch (Exception e) {
e.printStackTrace();
}
}
}
return fi;
}
http://stackoverflow.com/questions/9745988/how-can-i-programmatically-take-a-screenshot-of-a-webview-capturing-the -full-pa – 2014-12-05 08:39:36
http://stackoverflow.com/a/26353881/1777090 – 2014-12-05 08:39:45