我试图改变某些词(搜索结果),在颜色的的TextView
?我试图用ANSI颜色是这样的:
I am trying to change the color of certain words (Search results) in a TextView
? I tried to use ANSI colors like this:
text.setText("\u001B31;1m" + "someText");
但没有奏效。我如何做到这一点?
but it did not work. How do I achieve this?
这将帮助ü
Spannable WordtoSpan = new SpannableString("I know just how to whisper");
WordtoSpan.setSpan(new ForegroundColorSpan(Color.BLUE), 5, 13,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
textview.setText(WordtoSpan);