Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这个代码
TextView.append(Html.fromHtml((getString(R.string.example)))); <string name="example"><b><font color="red">Example</font></b></string>
因为我运行应用程序时文本不是红色的?有什么问题?
你可以试试这个:
myTextView.setText(Html.fromHtml(getString(R.string.example)));
添加 html 源代码的最佳方法strings.xml是使用
strings.xml
<![CDATA[html source code]]>
这是一个例子:
<string name="html"><![CDATA[<p>Text<p>]]></string>