/** Android文字局部变色 */
public void changeTextColor(int start, int end, TextView text) {
// TODO Auto-generated method stub
SpannableStringBuilder spannable = new SpannableStringBuilder(
text.getText().toString());// 用于可变字符串
ForegroundColorSpan span = new ForegroundColorSpan(Color.RED);
spannable.setSpan(span, start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
text.setText(spannable);
}
Android文字局部变色 TextView文字部分变色代码
最新推荐文章于 2022-10-29 11:31:09 发布