将 HTML 加载到 Android 中的 webview 中? [英] Load HTML into webview in Android?

查看:26
本文介绍了将 HTML 加载到 Android 中的 webview 中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将以下 html 内容加载到 web 视图中.但我收到以下错误:

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

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

Web page not available 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>

我不知道是什么问题?

推荐答案

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

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

这篇关于将 HTML 加载到 Android 中的 webview 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆