繁体   English   中英

Android从外部存储读取HTML文件

[英]Android reading html file from external storage

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

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

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

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

engine.loadUrl("file:///" + 
Environment.getExternalStorageDirectory().getPath() + 
"testing.html");

采用

engine.loadUrl("file:///"+Environment.getExternalStorageDirectory().getAbsolutePath() + "testing.html");

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM