Webview无法从预定义的html文件中读取

时间:2013-01-03 13:12:55

标签: android html webview

我有一个包含大量文本和基本html标签的html文件。该文件位于 res / raw 文件夹中。 但是,当我尝试从我的网络视图中显示此HTML时,</br&gt;不起作用,而<b></b>没问题。我的最小SDK为8,目标SDK为15。

这是屏幕截图:

webview screenshoot

这是html文件:

<!DOCTYPE HTML>
<article align="center">

Printf(“Hello World ^_^”);</br></br>

<b>This section will explain about the objective of this apps.</b></br>
This apps is designed for those who want to learn Computer Science (programming), with no experience necessary (so you don’t have to worry about your age, background, education, etc. EVERYONE can learn programming!).</br> 
This apps will teach you about the basics of the programming using C languange.</br>
</article>

这是webview代码:

webChapter.loadUrl("file:///android_res/raw/hello_world.html");

我尝试了这个,但没有运气,文件甚至无法阅读:

webChapter.loadDataWithBaseURL("file:///android_res/raw/", "hello_world.html", "text/html", "UT-8", "");

谢谢:D

1 个答案:

答案 0 :(得分:3)