问题
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?
Is there a particular way to pass the HTML resource to a WebView
?
Thanks!
回答1:
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");
回答2:
If your file is on the SD card, this reference will work:
content://com.android.htmlfileprovider/sdcard/filename.jpg
来源:https://stackoverflow.com/questions/3295381/android-html-resource-with-references-to-other-resources