<table style="width: 560px; border: 2px solid #fee3cc; font-size: 1em;" rules="all" border="1" cellpadding="5" cellspacing="0">
<tbody>
<tr>
<td>
<p>Bharatiya Jana Sangh</p>
</td>
<td>
<p>1951 - 1977</p>
</td>
</tr>
<tr>
<td>
<p>Janata Party</p>
</td>
<td>
<p>1977 - 1979</p>
</td>
</tr>
<tr>
<td>
<p>Bharatiya Janata Party</p>
</td>
<td>
<p>1980</p>
</td>
</tr>
</tbody>
</table>
上面是關於表格的 html代碼,我想按照上面的表格代碼在布局上直接顯示一個新表。如何實現呢?
在你的 activity 中添加:
WebView webview = new WebView(this);
setContentView(webview);
String yourHtml = "<html><body><table>...</table></body></html>";
webview.loadData(yourHtml , "text/html", "utf-8");