* 改变文字大小和字体样式** @param str* @param tv*/public void changeTextSize(String str, TextView tv) {Spannable WordtoSpan = new SpannableString(str);WordtoSpan.setSpan(new AbsoluteSizeSpan(20, true), 0, str.length() - 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);设置字体大小WordtoSpan.setSpan(new AbsoluteSizeSpan(10, true), str.length() - 1, str.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);WordtoSpan.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), 0, str.length() - 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);tv.setText(WordtoSpan);}
/*** 改变文字颜色* @param str* @param tv*/public void changeTextColor(String str,TextView tv){SpannableString spannableString = new SpannableString(str);ForegroundColorSpan colorSpan = new ForegroundColorSpan(mContext.getResources().getColor(R.color.color_main_line)); spannableString.setSpan(colorSpan, 2, spannableString.length()-4, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);tv.setText(spannableString);}