Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在我的 Android 项目中添加一个 HTML 资源,并引用其他资源(主要是可绘制对象)。
我应该把它放在哪里以及如何从中引用其他资源?
有没有一种特殊的方法可以将 HTML 资源传递给WebView?
WebView
谢谢!
html 文件进入根目录下的 assets 文件夹(作为 res 的同级文件夹)以及所有可绘制对象。您可以通过执行类似的操作来查看它
webView.loadUrl("file:///android_asset/filename.html");
如果您的文件在 SD 卡上,则此参考将起作用:
内容://com.android.htmlfileprovider/sdcard/filename.jpg