1 可首先在style中设置不同的style
<style name="charge_power">
<item name="android:textSize">@dimen/text_size_title</item>
<item name="android:textColor">@color/text_color_40</item>
</style>
......
2 SpannableString styleString = new SpannableString(".........");
styleString.setSpan(new TextAppearanceSpan(this,R.style.charge_power),0,str1.length(),Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
......
tv.setText(styleString,TextView.BufferType.SPANNABLE);