可能重复:
如何在TextView中显示HTML?
我有一个包含一些标签(字符串<p>,<img>等等).
讲述如何在textview中处理这些标记.
提前致谢.
textView.setText(Html.fromHtml("<p>" + title + "</p>");
Run Code Online (Sandbox Code Playgroud)
您还可以使用Web视图
WebView webview = new WebView(this);
setContentView(webview);
// Simplest usage: note that an exception will NOT be thrown
// if there is an error loading this page (see below).
webview.loadUrl("http://slashdot.org/");
// Of course you can also load from any string:
String summary = "<html><body>You scored <b>192 points.</body></html>";
webview.loadData(summary, "text/html", "utf-8");
Run Code Online (Sandbox Code Playgroud)
http://developer.android.com/reference/android/webkit/WebView.html
| 归档时间: |
|
| 查看次数: |
2673 次 |
| 最近记录: |