0
嗨,我制作了一个程序,该图像位于文件夹中(路径是sdcard/scheduler/pic.jpg)。 我该如何加载这张图片并显示它。我的图片应该可以放大。所以我使用Web视图来显示图像。该代码是下面使用webview从特定的floder加载图像
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setAllowFileAccess(true);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setBuiltInZoomControls(true);
String imagePath = "file:/sdcard/Schedular/233322.jpg";
String html = "<html><head></head><body><img src=\""+ imagePath + "\"></body></html>";
mWebView.loadData(html, "text/html","utf-8");
此代码不加载图像的问题。它只给白屏。我认为这是一条路径问题。请给出一个解决方案..