在strings.xml中的Andr​​oid的字符串粗体字 [英] Bold words in a string of strings.xml in Android

查看:131
本文介绍了在strings.xml中的Andr​​oid的字符串粗体字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在strings.xml中的一个字符串很长的文字。我想大胆和改变一些字的颜色中的文本。

I have a long text in one of the strings at strings.xml. I want to make bold and change the color of some words in that text.

我该怎么办呢?

在此先感谢

推荐答案

检查了这一点: 选择,突出,或样式文本部分

您基本上可以使用HTML标签在您的字符串资源,如:

You could basically use html tags in your string resource like:

<resource>
<string id="@+id/styled_welcome_message">We are <b><i>so</i></b> glad to see you.</string>
</resources>

和使用Html.fromHtml或使用spannable,检查我张贴的链接。

And use Html.fromHtml or use spannable, check the link I posted.

旧类似的问题:<一href="http://stackoverflow.com/questions/1529068/is-it-possible-to-have-multiple-styles-inside-a-textview">Is有可能有一个TextView里面的多种样式?

这篇关于在strings.xml中的Andr​​oid的字符串粗体字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆