安卓:让人物大胆XML大胆、人物、XML

2023-09-07 00:16:16 作者:皆是孤独

我写这条线在strings.xml中:

I write this line in the strings.xml:

<string name="Help">This<b>Caaaaaa</b> on the spot.</string>

℃之间的字符; B&GT; 标记不会成为大胆。我在做什么错误? PS:我只是想做出一些部分的字符串(如Caaaaa以上)粗体

But the characters between the <b> tag don't become bold. What am I doing incorrectly? PS:I just wanna make some part in the string (like "Caaaaa" above) bold.

推荐答案

当你设置一些小部件添加到该字符串文本使用下面的code:

When you set the text of some widget to this string use the following code:

在strings.xml中使用添加乌尔字符串:

In strings.xml use this to add ur string:

<string name="Help">
    <![CDATA[
    This <b>Caaaaaa</b> on the spot.
    ]]>
    </string>

在你的活动

yourWidget.setText(Html.fromHtml(getString(R.string.Help)));