Android字符高亮显示

整理旧笔记


String str = "adsjoiasdjpaisdjpaidj";
SpannableStringBuilder style = new SpannableStringBuilder(str);
style.setSpan(
        new ForegroundColorSpan(Color.RED), 
        3, 
        8, 
        Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
);
TextView.setText(style);

你可能感兴趣的:(Android字符高亮显示)