Android显示文本视图图
我正在从网页中检索一些html源代码。当我使用Android显示文本视图图,android,html,css,Android,Html,Css,我正在从网页中检索一些html源代码。当我使用Html.showHtml(htmlSource)时 它没有正确显示图表。 以下是网络上的图形,不带颜色: Day Date Time Event Location Fri Sep 27 4:00 PM Practice MSC Yellow Sun Sep 29 3:00 PM MJBL Game vs Runnin Rebels MSC Y
Html.showHtml(htmlSource)时代码>
它没有正确显示图表。
以下是网络上的图形,不带颜色:
Day Date Time Event Location
Fri Sep 27 4:00 PM Practice MSC Yellow
Sun Sep 29 3:00 PM MJBL Game vs Runnin Rebels MSC Yellow
以下是图表的html和css:
<table class="gymschedule">
<colgroup>
<col />
<col />
<col />
<col />
<col width="10" /> <!-- small! -->
<col />
<col />
</colgroup>
<thead>
<tr>
<td>
<nobr>Fri</nobr>
</td>
<td>
<nobr>Nov 1</nobr>
</td>
<td>
<nobr>4:00 PM</nobr>
</td>
<td>
Practice </td>
<td>
<nobr>MSC Yellow</nobr>
</td>
</tr>
<tr>
<td>
<nobr>Fri</nobr>
</td>
<td>
<nobr>Nov 8</nobr>
</td>
<td>
<nobr>4:00 PM</nobr>
</td>
<td>
Practice </td>
<td>
<nobr>MSC Yellow</nobr>
</td>
</tr>
</tbody>
</table>
星期五
11月1日
下午四点
实践
黄色硕士
星期五
11月8日
下午四点
实践
黄色硕士
如何在android手机上以文本或图像视图正确显示此图形?android TextView不支持
标记及其相关标记。有关TextView支持的HTML标记列表,请参阅
要显示它,您需要使用WebView。首先,将WebView添加到布局中:
<WebView
android:id="@+id/webView"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
然后在关联的活动中加载表格HTML:
String html = "<table> ..... </table>";
WebView webView = (WebView)findViewById(R.id.webView);
webView.loadData(html, "text/html", "utf-8");
String html=“…”;
WebView WebView=(WebView)findViewById(R.id.WebView);
加载数据(html、“文本/html”、“utf-8”);