android - 如何在android中的textview上获取一个值作为htmltext?

标签 android

<分区>

Possible Duplicate:
How to display HTML in TextView?

我有一个包含一些标签(<p><img> 等)的字符串。

讲述如何在textview中处理这些标签。

提前致谢。

最佳答案

textView.setText(Html.fromHtml("<p>" + title + "</p>");

您还可以使用网页 View

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");

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

关于android - 如何在android中的textview上获取一个值作为htmltext?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2147050/

相关文章:

javascript - Ionic 2 滚动性能问题

android - 有人知道让 AT&T 的无线代理在 45 秒后不超时的方法吗?

android - Facebook 广告不显示 Android

android - Google Translate API 出错(错误 :Execution failed for task ':app:transformClassesWithJarMergingForDebug, 重复条目)

android - OpenCV 标志检测 - 使用什么?

java - Intent 相机在后按后崩溃

java - Android - Editbox Drawable 左边没有正确填充

java - 按下android中的图像按钮并按顺序获取数组中的随机图像

android - 如何配置 Android 模拟器来模拟 Galaxy Nexus?

android - Room 中的多对多关系 CRUD