- TextView TV = (TextView)findViewById(R.id.mytextview01);
- Spannable WordtoSpan = new SpannableString("I know just how to whisper, And I know just how to cry,I know just where to find the answers");
- WordtoSpan.setSpan(new ForegroundColorSpan(Color.BLUE), 15, 30, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
- TV.setText(WordtoSpan);
TextView tv =
new
TextView(
this
);
//添加css样式
tv.setText(Html.fromHtml(
"<font color="
#ff0000
">红色</font>其它颜色"
));
或者使用SpanableString