不废话,按照以下操作即可

//重写shouldInterceptRequest webView.setWebViewClient(new WebViewClient() {                @Override                public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest webResourceRequest) {                    FileInputStream input;                    String url = "";                    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {                        url = webResourceRequest.getUrl().toString();                    }                    String key = "http://androidimg";                    if (url.contains(key)) {                        String imgPath = url.replace(key, "");                        try {                            input = new FileInputStream(new File(imgPath.trim()));                            WebResourceResponse response = new WebResourceResponse("image/jpg", "UTF-8", input);                            return response;                        } catch (FileNotFoundException e) {                            e.printStackTrace();                        }                    }                    return super.shouldInterceptRequest(view, webResourceRequest);                }            });
//js代码let img = document.getElementById("img");function onAcceptPhoto(imgUrl) {//imgUrl = android本地图片路径let androidImgKey = "http://androidimg";img.src = androidImgKey + imgUrl;}

更多相关文章

  1. Pycharm安装PyQt5的详细教程
  2. Android--SoLoader,android动态加载so库
  3. Android(安卓)命令行编译、打包生成apk文件
  4. android手机客户端上传文件,java servlet服务器端接收并保存到服
  5. Android(安卓)获取存储卡路径和空间使用情况
  6. android Uri获取真实路径转换成File的方法
  7. 解决Android模拟器打不开的问题!...
  8. Android:计算剩余内存
  9. Android(安卓)打开文件管理器 获取文件的真实路径

随机推荐

  1. 百度地图 Android SDK 技术详解集锦
  2. 【MNN学习五】在Android上部署MobileNetS
  3. Android: Attaching Sources to Librarie
  4. Android(安卓)手势检测及通过手势实现翻
  5. [zz http://www.cnblogs.com/oldfeel/arc
  6. Android中RelativeLayout相关属性
  7. Android 错误 'roundIcon' in package 'a
  8. Android编译系统
  9. 扫描二维码自动识别手机系统(Android/IOS)
  10. Android Studio使用问题解决