代码:
String secondInfo = "<font color=\"#B7B7B7\">" + "空余位: " + "</font>" + "<font color=\"#D95F5F\">" + "1072" + "</font>" + "<font color=\"#B7B7B7\">" + " 总车位: "+"1162" + "</font>"; holder.tv_second.setText(Html.fromHtml(secondInfo)); String thirdInfo = "<font color=\"#B7B7B7\">" + "价格: " + "</font>" + "<font color=\"#EAB547\">" + "61" + "</font>" + "<font color=\"#B7B7B7\">" + " 元/小时" + "</font>"; holder.tv_third.setText(Html.fromHtml(thirdInfo));
效果:
本文出自 “菜鸟的心路历程” 博客,转载请与作者联系!
android 通过html设置textview的内容不同种颜色
原文地址:http://wyh1990.blog.51cto.com/10023534/1683583