V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
shenhb
V2EX  ›  Android

android x5webview,截长图有不模糊的写法吗,现在截图出来都很模糊

  •  
  •   shenhb · 2019-07-15 11:17:40 +08:00 · 5091 次点击
    这是一个创建于 1719 天前的主题,其中的信息可能已经有所发展或是发生改变。
    2 条回复    2019-07-15 14:58:54 +08:00
    shenhb
        1
    shenhb  
    OP
       2019-07-15 14:52:09 +08:00
    shenhb
        2
    shenhb  
    OP
       2019-07-15 14:58:54 +08:00
    java 代码
    `
    private Bitmap captureWebView(WebView webView) {

    int wholeWidth = webView.computeHorizontalScrollRange();
    int wholeHeight = webView.computeVerticalScrollRange();
    Bitmap x5bitmap = Bitmap.createBitmap(wholeWidth , wholeHeight, Bitmap.Config.ARGB_8888);

    Canvas x5canvas = new Canvas(x5bitmap);
    x5canvas.scale((float) wholeWidth / (float) webView.getContentWidth(), (float) wholeHeight / (float)webView.getContentHeight());
    if ( webView.getX5WebViewExtension() == null) {
    return null;
    }

    webView.getX5WebViewExtension().snapshotWholePage(x5canvas, false, false);
    return x5bitmap;
    }

    `
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2798 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 11:49 · PVG 19:49 · LAX 04:49 · JFK 07:49
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.