修改部分字体大小
原字体:字体大小改变 修改后:字体大小改 变1
2
3
4
5CharSequence charSequence1 = "字体改变大小";
SpannableString spannableString = new SpannableString(charSequence1);
spannableString.setSpan(new RelativeSizeSpan(0.5f), charSequence1.length() - 1,
charSequence1.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
tvTitle.setText(spannableString);
修改部分字体颜色
原字体:字体改变颜色 修改后:字体改变颜 色1
2
3
4
5
6
7CharSequence charSequence = "字体改变颜色";
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(charSequence);
spannableStringBuilder.setSpan(
new ForegroundColorSpan(getResources().getColor(R.color.gl_vip_up)),
spannableStringBuilder.length() - 1, spannableStringBuilder.length(),
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
tvTitle.setText(spannableStringBuilder);
注:待补充