我在 strings.xml 的一个字符串中有一个长文本。我想加粗并更改该文本中某些单词的颜色。
我该怎么做?
最佳答案
您基本上可以在字符串资源中使用 html 标签,例如:
<resource>
<string name="styled_welcome_message">We are <b><i>so</i></b> glad to see you.</string>
</resources>
并使用 Html.fromHtml 或使用 spannable,检查我发布的链接。
旧的类似问题:Is it possible to have multiple styles inside a TextView?
关于java - Android中strings.xml字符串中的粗体字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7130619/