1 SpannableStringBuilder style = new SpannableStringBuilder(str); 2 style.setSpan( 3 new ForegroundColorSpan(getResources().getColor( 4 R.color.tab_sel_color)), 0, t1.length() - 1, 5 Spannable.SPAN_EXCLUSIVE_INCLUSIVE); 6 style.setSpan( 7 new ForegroundColorSpan(getResources().getColor( 8 R.color.tab_sel_color)), t1.length() + 3, 9 t1.length() + 3 + t2.length(), 10 Spannable.SPAN_EXCLUSIVE_INCLUSIVE); 11 mCarGuidancePrice.setText(style);