使用HTML标记设置样式,它在strings.xml中不起作用

mar*_*rro 4 string android android-xml

使用HTML标记设置样式,它在strings.xml中不起作用,我不知道,为什么.

<string name="autores">This aplication is developed by <i>Charles</i></string>
Run Code Online (Sandbox Code Playgroud)

它在查尔斯这个词中没有用斜体表示这句话.这可能是什么问题?

非常感谢

Meh*_*sar 8

解:

您可以使用CDATASection.

例:

<string name="autores">
<![CDATA[
This application is developed by <i>Charles</i>
]]>
</string>
Run Code Online (Sandbox Code Playgroud)

dialog.setMessage(Html.fromHtml(this.getString(R.string.autores)));
Run Code Online (Sandbox Code Playgroud)

参考:

的CDATASection

我希望它会有所帮助!!