Kaj*_*Kaj 60
是的,如果您使用,可以在文本的不同位置使用不同的颜色SpannableString.例:
SpannableString text = new SpannableString("Lorem ipsum dolor sit amet");
// make "Lorem" (characters 0 to 5) red
text.setSpan(new ForegroundColorSpan(Color.RED), 0, 5, 0);
textView.setText(text, BufferType.SPANNABLE);
Run Code Online (Sandbox Code Playgroud)
有一个更完整的例子在这里.
啊我发现它使用下面的代码
myTextView.setText(Html.fromHtml(html text having 1 in red 2 in green and so on));
Run Code Online (Sandbox Code Playgroud)
我不懂网络,所以你最好咨询可以为你编写 html 的人:P
| 归档时间: |
|
| 查看次数: |
14391 次 |
| 最近记录: |