android - When capturing webview, content without displaying view is white -
i have question webview.
it`s source , result.
private void savedocumentimage() { webview wv = arrwebview.get(0); wv.measure(measurespec.makemeasurespec(measurespec.unspecified, measurespec.unspecified), measurespec.makemeasurespec(0, measurespec.unspecified)); int y=wv.getheight(); bitmap captureview = bitmap.createbitmap(wv.getmeasuredwidth(), wv.getmeasuredheight(), bitmap.config.argb_8888); wv.layout(0, 0, wv.getmeasuredwidth(), wv.getmeasuredheight()); canvas screenshotcanvas = new canvas(captureview); wv.draw(screenshotcanvas); if (captureview != null) { try { string path = environment.getexternalstoragedirectory().tostring(); outputstream fout = null; file file = new file(path, "temp"); if (!file.exists()) file.mkdirs(); fout = new fileoutputstream(path + "/temp/test_0.jpg"); captureview.compress(bitmap.compressformat.jpeg, 100, fout); wv.setdrawingcacheenabled(false); } catch (filenotfoundexception e) { e.printstacktrace(); } } wv.destroydrawingcache(); captureview.recycle(); captureview=null; }
and here same mine. : https://stackoverflow.com/questions/37023619/capturing-bitmap-android-chromium-webview-returns-content-as-white
u can't take screen shot of web view , surface view because content loaded in holders , holder not view. if find way share it. once did little research on , found this haven't tested yet. try if works accept answer :d. best of luck
Comments
Post a Comment