Android TextView 中 SetText() 的高级用法。
//效果,红色字为红色,其他颜色为黑色
textView.setText(Html.fromHtml("<font color=\"#ff0000\">红色</font>其它颜色"));
//效果,获得两个字为红色,后面字背景颜色为红色。
String text = "获得银色宝箱";
SpannableStringBuilder style = new SpannableStringBuilder(text);
style.setSpan(new BackgroundColorSpan(Color.RED),2,6, Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
style.setSpan(new ForegroundColorSpan(Color.RED),0,2,Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
textView.setText(style);