加载HTML到web视图Android中?视图、加载、web、HTML

2023-09-05 23:43:38 作者:国民老攻

我加载下面的HTML内容到web视图。但即时得到以下错误:

  不可用

网页   为text / html;!UTF8%3C DOCTYPE%20HTML%20PUBLIC%20 // W3C //   ........

和多个

安卓多页面视图怎么退出 android studio 查看页面视图层级 CSDN

这是我的HTML内容

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

过渡// EN>< HTML>< HEAD><冠军>性格ABC< /标题>< /头><身体GT;<表

边界=0的cellpadding =0CELLSPACING =0的宽度=100%>&其中; TR>&其中; TD

ALIGN =中心><强> [红 - 蓝]萨钦< / STRONG>< BR />< IMG

SRC =r7y3b6.pngALT =[红 - 蓝]

萨钦称号=[红 - 蓝]萨钦/>< BR />萨钦< / TD>< TD ALIGN =中心><强>

[黄红 - 蓝]测试1< / STRONG>< BR />< IMG SRC =5y5b5.pngALT =[黄 - 红 - 蓝] Test1的TITLE =[黄 - 

红蓝色]测试1/&GT;&LT; BR />Test1</td></tr></table><br/><p><strong>Harmony:</strong></p>
&LT; P&GT;&LT;强&GT;测试1&LT; / STRONG&GT;和&lt;强&GT;萨钦&LT; / STRONG&GT;经验很多相似之处

一起。这两个性格有强烈的红色(占主导地位,权威和不耐烦)

和蓝色(理性,保留和分析)两侧,互相理解和放大器; rsquo的; S

性质;两者都是理性的,周到的,但占主导地位,权威和强大

领导者在同一时间。双方将爱情进行控制和爱是优越,有一个

需要进步和挑战的热爱和LT; / P&GT;
&LT; P&GT;&LT;强&GT;潜在的冲突:其中; / STRONG&GT;&LT; / P&GT;
&LT; P&GT;&LT;强&GT;测试1&LT; / STRONG&GT;拥有所有3个性于一体和&lt;强&GT; &LT; / STRONG&GT;获取

恼火容易。这就像从一个到另一个,然后再返回心情开关:

黄(友好,善良),红色(占主导地位,需要带领),蓝(理性,思考

通过,是客观的)。这激怒&LT;强&GT;萨钦&LT; / STRONG&GT;因为他/她发现

这令人沮丧,当一个人无法弥补他们的头脑。 &LT;强&GT;测试1&LT; / STRONG&GT;

有时感觉困惑和EX presses它!&功放; ldquo;我很困惑和放大器; rdquo;的这是

很难&LT;强&GT;萨钦&LT; / STRONG&GT;对付以&lt; / P&GT;&LT; /身体GT;&LT; / HTML&GT;
 

我不知道是什么问题?

解决方案

 的WebView WV =(web视图)findViewById(R.id.webView);

wv.loadDataWithBaseURL(notreal /,data_html,text / html的,UTF-8,NULL);
 

I am loading following html content into the webview. But im getting following error:

Web page not available text/html;utf8%3C!DOCTYPE%20HTML%20PUBLIC%20//W3C// ........

and more

This is my html content

<!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>

I dont know what is problem?

解决方案

WebView wv = (WebView)findViewById(R.id.webView);

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