您的位置:首页 > 移动开发 > Android开发

android同一个TextView设置不同颜色字体

2015-04-07 10:20 766 查看
SpannableStringBuilder style = new SpannableStringBuilder(str);
style.setSpan(
new ForegroundColorSpan(getResources().getColor(
R.color.tab_sel_color)), 0, t1.length() - 1,
Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
style.setSpan(
new ForegroundColorSpan(getResources().getColor(
R.color.tab_sel_color)), t1.length() + 3,
t1.length() + 3 + t2.length(),
Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
mCarGuidancePrice.setText(style);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐