对于XML布局颜色字符串资源 [英] color string resource for xml layout

查看:113
本文介绍了对于XML布局颜色字符串资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<string name="some_text">this is <font fgcolor="#ffff0000">red</font></string>

<string name="some_text">this is <font color="#ffff0000">red</font></string>

是不是这样做。

我需要调用一个XML的TextView字符串。我如何得到它的工作?不,我不想用一个水平的LinearLayout与一群TextViews的。

I need to call the string in an xml TextView. How do I get it to work? No I don't want to use a horizontal LinearLayout with a bunch of TextViews.

推荐答案

TextView中不支持直接输入HTML文本,但一些其他的答案似乎向您展示如何获得 HTML 从String对象。如果您想格式化你需要使用 Spannable 实例设置文本格式的部分一个TextView中的文本有不同的颜色,字体等,这是唯一的好,如果你不'T已经在HTML文本虽然,当然。

TextView doesn't support entering HTML text directly, though some of the other answers seem to show you how to get a Html object from the String. If you want to format the text within a TextView you need to use Spannable instances to format the sections of text to have different colours, fonts etc. This is only good if you don't already have your text in HTML though, of course.

这篇关于对于XML布局颜色字符串资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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