当前位置:编程学习 > wap >>

Android webView截图

使用 Picture pc = webView.capturePicture();
然后截百度图片网站的内容
得到的截图不显示网站图片 --------------------编程问答-------------------- Picture picture = view.capturePicture();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int width = picture.getWidth();
int height = picture.getHeight();
if (width > 0 && height > 0) {
Bitmap bmp = Bitmap.createBitmap(width, height,
Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bmp);
picture.draw(canvas);
bmp.compress(Bitmap.CompressFormat.JPEG, 100, baos);
FileOutputStream fos = null;
try {
fos = new FileOutputStream("/sdcard/aaa/" + System.currentTimeMillis() + ".jpg");
if (fos != null) {
bmp.compress(Bitmap.CompressFormat.JPEG, 100, fos);
fos.close();
}
Toast.makeText(Ex08_21Activity.this, "截图成功",
Toast.LENGTH_SHORT).show();
} catch (Exception e) {
e.printStackTrace();
}
}
}
在onPageFinished()中完成。我测试通过。 --------------------编程问答-------------------- 如果有JS加载的怎么截图呢
补充:移动开发 ,  Android
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,