开发者

android text color

开发者 https://www.devze.com 2023-02-14 06:53 出处:网络
Is it possible to have different colored texts within the same text view? I\'ve been trying to use the Spannable class to style my texts but the documentat开发者_如何转开发ion is completely useless

Is it possible to have different colored texts within the same text view?

I've been trying to use the Spannable class to style my texts but the documentat开发者_如何转开发ion is completely useless on how to style text with it.


Use Html.fromHtml, the font tag and the color attribute...

String s = "<font color='#FF0000'>I'm read</font> <font color='#0000FF'>and I'm blue</font>";
textView.setText(Html.fromHtml(s));
0

精彩评论

暂无评论...
验证码 换一张
取 消