我将 HTML 扔到 webview 中进行渲染。在 HTML 中,我需要加载我在/res/drawable
.
我有/res/drawable/my_image.png
这样的代码:
final WebView browser = (WebView) findViewById(R.id.my_webview);
String html = new MyHelper(myObject).getHtml();
browser.loadDataWithBaseURL("", html, "text/html", "UTF-8", "");
字符串html
有类似的地方:
<html><head>
<h1>Here is the image</h1>
<img src="my_image.png" />
</head><html>
问题是,该图像src
属性应该是什么来引用图像/res/drawable
?