我有一个HTML文件在我/res/raw/test.html如何把图像从绘制文件夹在HTML文件
,我用它显示在Web视图下面的代码
WebView wbview = (WebView)findViewById(R.id.webView1);
InputStream fin;
try
{
fin = getResources().openRawResource(R.raw.manual);
byte[] buffer = new byte[fin.available()];
fin.read(buffer);
fin.close();
wbview.loadData(new String(buffer), "text/html", "UTF-8");
}
catch (IOException e)
{
e.printStackTrace();
}
而且这是我的我的HTML代码的文件
<html>
<p>
Lorem ipsum dolor sit amet,
</p>
<table>
<tr>
<td>
<img src=\\"file:///android_asset/test_image2.jpg\"/>
<img src="test_image2.jpg" width="50px" alt="Hi">
<img src=\"res/drawable/test_image.png"/>
<img src="file:///android_res/drawable/test_image.png" />
<img src=\"file:///android_res/drawable/test_image.png"\ />
</td>
</tr>
</table>
</html>
我想在我的HTML文件,显示从我的资源文件夹中的图片 我尝试了所有的可能性依然无法正常工作。它只是显示一个HTML文本,但对于像我没有想法如何表达
请帮我
您可以通过 乔纳斯阿尔维斯 http://stackoverflow.com/questions/4534043/android-add-image-to-webview-from-a-drawable – Krutik 2012-04-18 08:35:48