80,337
社区成员
发帖
与我相关
我的任务
分享
TextView textView = (TextView) findViewById(R.id.test_tv);
TextView textView2 = (TextView) findViewById(R.id.test_tv2);
SpannableString spannableString = new SpannableString("aaa");
ForegroundColorSpan colorSpan = new ForegroundColorSpan(Color.YELLOW);
spannableString.setSpan(colorSpan, 0, 2, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
textView.setText(spannableString);
SpannedString spannable = (SpannedString) textView.getText();
textView2.setText(spannable);