Android版的setBackground颜色自定义文本查看 [英] Android Setbackground Color For Custom Text View
本文介绍了Android版的setBackground颜色自定义文本查看的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我米试图背景颜色文本视图设置到该文本视图的文本的长度,
如果我使用 textView.SetBackground()
那么它将设置背景颜色为全TextView的,我不想这样,我想backgorund颜色只为TextView的...致谢文本提前...
I m trying to set background color text view to length of the text in that text view ,
if I use textView.SetBackground()
then it will set background color to whole textview , i dont want this , I want backgorund color only for Text of that Textview... Thanks in advance...
推荐答案
您可以使用
String text = "This is <font color='blue'>blue</font>. This is <font color='red'>red</font>.";
textView.setText(Html.fromHtml(text), TextView.BufferType.SPANNABLE);
这篇关于Android版的setBackground颜色自定义文本查看的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文