开发者

android text color

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜