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