0

只是想知道我需要如何格式化 android.widget.TextView 文本,以便

  <p> does not show </p>  // the <p> symbol should not be shown.

谢谢

4

3 回答 3

2

来自 Html 类。您可以使用,

Html.FromHtml(<Html String>);

还支持标签类型,请看这个..

http://commonsware.com/blog/Android/2010/05/26/html-tags-supported-by-textview.html

例子:

String htmlString = "<p> does not show </p>";
textView.setText(Html.FromHtml(htmlString));
于 2013-01-07T08:45:12.157 回答
2

用这个

textview.setText(Html.fromHtml("YOUR STRING"));
于 2013-01-07T08:45:15.627 回答
1

将字符串定义为:

<resource>
    <string name="your_string">This is an <p>paragraph</p> text demo for TextView.</string>
</resources>
于 2013-01-07T08:46:16.890 回答