码迷,mamicode.com
首页 > 移动开发 > 详细

android 通过html设置textview的内容不同种颜色

时间:2015-08-11 19:20:35      阅读:150      评论:0      收藏:0      [点我收藏+]

标签:android   html   textview   字体颜色   

代码:

		
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的内容不同种颜色

标签:android   html   textview   字体颜色   

原文地址:http://wyh1990.blog.51cto.com/10023534/1683583

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!