在Android中将HTML加载到webview中?

在Android中将HTML加载到webview中?,android,webview,Android,Webview,我正在将以下html内容加载到webview中。但我有以下错误: 网页不可用 text/html;utf8%3C!DOCTYPE%20HTML%20PUBLIC%20//W3C// 还有更多 这是我的html内容 <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'><html><head><title>Personality ABC</title></

我正在将以下html内容加载到webview中。但我有以下错误:

网页不可用 text/html;utf8%3C!DOCTYPE%20HTML%20PUBLIC%20//W3C//

还有更多

这是我的html内容

<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 

Transitional//EN'><html><head><title>Personality ABC</title></head><body><table 

border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td 

align="center"><strong>[Red-Blue] Sachin</strong><br /><img 

src="r7y3b6.png" alt="[Red-Blue] 

Sachin" title="[Red-Blue] Sachin" /><br />Sachin</td><td align="center"><strong>

[Yellow-Red-Blue] Test1</strong><br /><img src="5y5b5.png" alt="[Yellow-Red-Blue] Test1" title="[Yellow-

Red-Blue] Test1" /><br />Test1</td></tr></table><br/><p><strong>Harmony:</strong></p>
<p><strong>Test1</strong> and <strong>Sachin</strong> experience lots of similarities 

together. Both personalities have strong red (dominant, authoritative and impatient) 

and blue (rational, reserved and analytic) sides and understand each other&rsquo;s 

nature; both being rational, thoughtful but dominant, authoritative and a strong 

leader at the same time. Both love to be in control and love to be superior and have a 

need for progress and a love for challenges.</p>
<p><strong>Conflict potential:</strong></p>
<p><strong>Test1</strong> has all 3 personalities in one and<strong> </strong>gets 

irritated easily. It is like a mood switch from one to the other and back again: 

yellow (friendly, kind) to red (dominant, need to lead) to blue (rational, thinking 

through, being objective). This irritates <strong>Sachin</strong> because he/she finds 

it frustrating when someone cannot make up their mind. <strong>Test1</strong> 

sometimes feels confused and expresses it with: &ldquo;I am confused!&rdquo; This is 

difficult for <strong>Sachin</strong> to deal with.</p></body></html>
个性ABC[Red-Blue]Sachin

Sachin [黄-红-蓝]测试1

和谐:

Test1Sachin有很多相似之处 在一起两种性格都有强烈的红色(支配性、权威性和不耐烦) 蓝色(理性、保守和分析)的一面,相互理解;s 性质;都是理性的、深思熟虑但占主导地位的、权威的和强有力的 同时领导。两人都喜欢控制自己,都喜欢高人一等,拥有一个 需要进步,热爱挑战

潜在冲突:

测试1将所有3种性格都集中在一个测试中,并且获得 容易生气。这就像一个情绪开关,从一个切换到另一个,然后再切换: 黄色(友好,善良)到红色(主导,需要引导)到蓝色(理性,思考) 通过,客观)。这激怒了Sachin,因为他/她发现 当有人拿不定主意时,这是令人沮丧的Test1 有时会感到困惑,并用“ldquo;我糊涂了&rdquo;这是 萨钦很难应付


我不知道是什么问题?

我有这个代码来打开html

WebView web = new WebView(this);
web.loadUrl("file:///sdcard/file.html");//The file:// is the protocol and it's nedded for internal files

如何加载?代码请删除我使用的标签@fazo,就像这个webView.loadData(str,“text/html”,“utf-8”);1) 确保str中有任何内容2)按照ahmad的建议删除doctype 3)最终尝试使用非常简单的文本作为strhi,我认为他可以加载html数据,而无需将文件保存在sdcard等中,这是肯定的。不过,根据一项评论,mime类型应该是“text/html”
WebView wv = (WebView)findViewById(R.id.webView);

wv.loadDataWithBaseURL("notreal/", data_html, "text/html", "utf-8",null);