WebView的截屏实现

时间:2014-06-26 07:37:38   收藏:0   阅读:199

 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所有内容都进行截取。

WebView的截屏实现,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!