WebView的截屏实现

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

posted @ 2017-06-15 13:23  gccbuaa  阅读(455)  评论(0编辑  收藏  举报