@android显示/ RES /可视的web视图视图、可视、android、RES

由网友(哥等的不是红灯℃)分享简介:我扔HTML到web视图渲染。在HTML我需要加载,我在一个图像 / RES /绘制。I am throwing HTML to a webview to render. In the HTML I need to load an image that I have in /res/drawable.我有 /res...

我扔HTML到web视图渲染。在HTML我需要加载,我在一个图像 / RES /绘制

I am throwing HTML to a webview to render. In the HTML I need to load an image that I have in /res/drawable.

我有 /res/drawable/my_image.png 和code像这样的:

I have /res/drawable/my_image.png and code such as this:

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 /绘制

The question is, what should that image src attribute be to refer to the image in /res/drawable?

推荐答案

这曾在安卓2.2

<img src = "file:///android_res/drawable/q1.png" />

在这里q1.png是在res /绘制,华电国际文件夹

where q1.png is in the res/drawable-hdpi folder

阅读全文

相关推荐

最新文章