在考虑其他资源的Andr​​oid HTML资源资源、Andr、HTML、oid

2023-09-06 13:54:15 作者:感情的肇事者

我想一个HTML资源添加到我的Andr​​oid项目,引用其他资源(主要是可绘制)。

I would like to add an HTML resource to my Android project with references to other resources (mainly drawables).

我应该在哪里把它和我怎么引用其他资源呢?

Where should I put it and how do I reference other resources from it?

有没有传递HTML资源到的WebView一种特殊的方式

Is there a particular way to pass the HTML resource to a WebView?

谢谢!

推荐答案

HTML文件进入根的资产文件夹(如水库的兄弟文件夹),以及所有的可绘制。你可以做这样的事情

The html file goes into the assets folder in root (as a sibling folder of res), as well as all the drawables. You can view it by doing something like

webView.loadUrl("file:///android_asset/filename.html");