与链接到/ assets文件夹.html文件加载的WebView [英] Load WebView with .html file linked to /assets folder

查看:358
本文介绍了与链接到/ assets文件夹.html文件加载的WebView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要加载HTML文件到的WebView,但这个文件位于硬盘上的文件夹外。我不能在我的Andr​​oid项目中复制文件到/ assets文件夹。但我可以创建一个链接到该文件在Eclipse中。

I need to load .html file into WebView but this file is situated in external folder on disk. I cannot copy file into /assets folder under my android project. But i can create a link to this file in Eclipse.

问题是我怎么能这样链接文件加载到的WebView?

The question is how can i load this linked file into WebView?

我试着用webView.loadUrl加载它(文件:///android_asset/myFile.html),但它的工作。的WebView不能在'/入资产价值文件夹中找到myFile.html。 (myFile.html链接/资产产生文件夹移动到磁盘上的文件夹外真实的文件。)

I tried to load it with webView.loadUrl("file:///android_asset/myFile.html") but it did work. WebView cannot find 'myFile.html' in '/assests' folder. ('myFile.html' link in /assests folder to real file in external folder on disk.)

请给任何想法!!!!
在此先感谢!

Please give any idea!!!! Thanks in advance!

推荐答案

如果您在OS X或Linux,尝试创建一个符号链接到您的项目资产/ 的文件中的问题。我怀疑一个Eclipse链接就足够了,因为资产打包成APK是不是Eclipse的工作,并通过Eclipse的调用Android的工具可能不知道关于Eclipse的链接。

If you are on OS X or Linux, try creating a symlink into your project assets/ for the file in question. I doubt that an Eclipse link will be sufficient, as packaging assets into the APK is not Eclipse's job, and the Android tools invoked by Eclipse may not know about Eclipse links.

这篇关于与链接到/ assets文件夹.html文件加载的WebView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆