无法在网络视图中加载 html

not able to load html in web view

在我的应用程序中,我想在网络中显示 html 数据 view.I 试过了,但是 html 数据没有显示在 webview.Please 中,这对我有帮助出来

代码

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



        if (!strSendTo.equals("")) {
            etSendTo.setText(strSendTo);
        }

        if (!htmlData.equals("")) {

            webView.loadData(htmlData, MIME_TYPE, ENCODING);
        }

Html

<HTML>

<HEAD>
  <TITLE></TITLE>
</HEAD>

<BODY>
  <TABLE border=0 cellSpacing=0 cellPadding=10 background=#FFFFFF align=center>
    <TBODY>
      <TR>
        <TD vAlign=top>
          <TABLE style=MARGIN-TOP: 40px border=0 cellSpacing=0 cellPadding=0 width=709 align=center>
            <TBODY>
              <TR>
                <TD>&nbsp;</TD>
              </TR>
              <TR>
                <TD>
                  <P>
                    <STRONG>Hello Jadya ,</STRONG>
                  </P>
                  <P>Please check your expenses of trip 'Goa' dated from 14/04/2015 to 23/04/2015.</P>
                </TD>
              </TR>
              <TR>
                <TD height=15></TD>
              </TR>
              <TR>
                <TD>
                  <TABLE border=1 cellSpacing=0 cellPadding=5>
                    <TBODY>
                      <TR>
                        <TD height=30 colSpan=6 align=middle>
                          <STRONG>Credit / Contribution </STRONG>
                        </TD>
                      </TR>
                      <TR>
                        <TD width=140 noWrap align=left>
                          <STRONG>Category</STRONG>
                        </TD>
                        <TD width=120 noWrap align=right>
                          <STRONG>Amount</STRONG>
                        </TD>
                      </TR>
                      <TR>
                        <TD noWrap align=left>Contribution</TD>
                        <TD noWrap align=right>1000.00</TD>
                      </TR>
                      <TR>
                        <TD noWrap align=left>Expenses</TD>
                        <TD noWrap align=right>0.00</TD>
                      </TR>
                      <TR>
                        <TD width=140 noWrap align=left>
                          <STRONG>Total</STRONG>
                        </TD>
                        <TD width=120 noWrap align=right>
                          <STRONG>1000.00</STRONG>
                        </TD>
                      </TR>
                    </TBODY>
                  </TABLE>
                </TD>
              </TR>
              <TR>
                <TD height=15></TD>
              </TR>
              <TR>
                <TD height=8>
                  <TABLE border=1 cellSpacing=0 cellPadding=5>
                    <TBODY>
                      <TR>
                        <TD height=30 colSpan=6 align=middle>
                          <STRONG>Payable Amount</STRONG>
                        </TD>
                      </TR>
                      <TR>
                        <TD width=140 noWrap align=left>
                          <STRONG>Category</STRONG>
                        </TD>
                        <TD width=120 noWrap align=right>
                          <STRONG>Amount</STRONG>
                        </TD>
                      </TR>
                      <TR>
                        <TD noWrap align=left>Drink</TD>
                        <TD noWrap align=right>40.00</TD>
                      </TR>
                      <TR>
                        <TD noWrap align=left>Entertainment</TD>
                        <TD noWrap align=right>200.00</TD>
                      </TR>
                      <TR>
                        <TD width=140 noWrap align=left>
                          <STRONG>Total</STRONG>
                        </TD>
                        <TD width=120 noWrap align=right>
                          <STRONG>240.00</STRONG>
                        </TD>
                      </TR>
                    </TBODY>
                  </TABLE>
                </TD>
              </TR>
              <TR>
                <TD height=15></TD>
              </TR>
              <TR>
                <TD height=8> </TD>
              </TR>
              <TR>
                <TD style=BACKGROUND-REPEAT: repeat-x ; HEIGHT: 2px; BACKGROUND-POSITION: center 140px; background=></TD>
              </TR>
              <TR>
                <TD height=8>
                  <TABLE border=0 cellSpacing=0 cellPadding=5>
                    <TBODY>
                      <TR>
                        <TD height=30 colSpan=6 align=left>
                          <h3><u>Net Balance</u></h3></TD>
                      </TR>
                      <TR>
                        <TD width=140 noWrap align=left>
                          <STRONG>Credit / Contribution</STRONG>
                        </TD>
                        <TD width=120 noWrap align=right>1000.00</TD>
                      </TR>
                      <TR>
                        <TD width=140 noWrap align=left>
                          <STRONG>Payable</STRONG>
                        </TD>
                        <TD width=120 noWrap align=right>-240.00</TD>
                      </TR>
                      <TR>
                        <TD width=140 noWrap align=left>
                          <STRONG>Amount Received From</STRONG>
                        </TD>
                        <TD width=120 noWrap align=right>-0.00</TD>
                      </TR>
                      <TR>
                        <TD colspan=2>
                          <HR size=1> </td>
                      </TR>
                      <TR>
                        <TD width=140 noWrap align=left>
                          <STRONG>Net Balance</STRONG>
                        </TD>
                        <TD width=120 noWrap align=right>
                          <STRONG>760.00</STRONG>
                        </TD>
                      </TR>
                    </TBODY>
                  </TABLE>
                </TD>
              </TR>
              <TR>
                <TD style=BACKGROUND-REPEAT: repeat-x ; HEIGHT: 2px; BACKGROUND-POSITION: center 140px; background=></TD>
              </TR>
              <TR>
                <TD height=8></TD>
              </TR>
              <TR>
                <TD height=8></TD>
              </TR>
              <TR>
                <TD height=8 width=709></TD>
              </TR>
              <TR>
                <TD style=BACKGROUND-REPEAT: repeat-x; BACKGROUND-POSITION: center 140px; background=></TD>
              </TR>
              <TR>
                <TD height=8></TD>
              </TR>
              <TR>
                <TD height=8></TD>
              </TR>
            </TBODY>
          </TABLE>
        </TD>
      </TR>
    </TBODY>
  </TABLE>
</BODY>

</HTML>

来自 WebView Class 官方页面:

http://developer.android.com/reference/android/webkit/WebView.html

String summary = "<html><body>You scored <b>192</b> points.</body></html>";
webview.loadData(summary, "text/html", null);

为什么你的 Html 标签是大写的?