1

我正在尝试在 /storage/sdcard0/... 中显示 html 文件

WebView engine = (WebView) (findViewById(R.id.webView1));
engine.setWebViewClient(new WebViewClient());
engine.loadUrl(Environment.getExternalStorageDirectory().getPath() + "testing.html");

但网页无法显示....有人可以帮忙吗?谢谢!

4

2 回答 2

7

解决了!!!应该在前面添加“file:///”=]=]

engine.loadUrl("file:///" + 
Environment.getExternalStorageDirectory().getPath() + 
"testing.html");
于 2013-03-27T05:42:00.643 回答
2

利用

engine.loadUrl("file:///"+Environment.getExternalStorageDirectory().getAbsolutePath() + "testing.html");
于 2013-03-27T05:44:15.463 回答