单TextView中有两种不同颜色的文字 [英] Single TextView with two different colored text
本文介绍了单TextView中有两种不同颜色的文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
正如标题所说,我想知道的是有可能实现两种不同颜色的字符在一个TextView元素。
As the title says, I want to know is it possible to achieve two different colored characters in a single textview element.
推荐答案
是的,如果你用甲酸盐HTML
yes, if you formate the String with html
String text = "<font color=#cc0029>Erste Farbe</font> <font color=#ffcc00>zweite Farbe</font>";
yourtextview.setText(Html.fromHtml(text));
这篇关于单TextView中有两种不同颜色的文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文