本文共 356 字,大约阅读时间需要 1 分钟。
方法一:
TextView tv = new TextView(this);
tv.setText(Html.fromHtml ("<font color=/"#ff0000/">红色</font>其它颜色"));
方法二:
String content = "测试测试我我是是 是]我,,,,,";
SpannableStringBuilder styled = new SpannableStringBuilder(content); styled.setSpan(new ForegroundColorSpan(Color.BLUE), 1, content.lastIndexOf("]"),Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); tv.setText(styled);转载地址:http://iwefb.baihongyu.com/