SpannableStringBuilder的简单用法
一段代码,贴了自己以后看:
TextView mText = (TextView) findViewById(R.id.mText);String mTxt = "你说的是人话么,df是么好的";SpannableStringBuilder spannable = new SpannableStringBuilder(mTxt);ForegroundColorSpan span = new ForegroundColorSpan(Color.RED);spannable.setSpan(span, 0, mTxt.length()-4, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);mText.setText(spannable);