android中TextView与Html结合使用实现字体和颜色的不同,并且换行
2015-11-26 10:23
645 查看
if (item.getComments() != null) { StringBuffer buffer = new StringBuffer(); for (int i = 0; i < item.getComments().size(); i++) { buffer.append("<font size=\"3\" color=\"#FFA042\">" + item.getComments().get(i).getFromUsername() + "</font>"); if (item.getComments().get(i).getToUsername() != null) { buffer.append("<font size=\"3\" color=\"black\">" + "回复" + "</font>"); buffer.append("<font size=\"3\" color=\"#FFA042\">" + item.getComments().get(i).getToUsername() + "</font>"); } buffer.append(":"); buffer.append("<font size=\"3\" color=\"black\">" + item.getComments().get(i).getMsgtxt() + "</font><br>"); } holder.tvHomeDtShowCommon.setText(Html.fromHtml(buffer.toString())); buffer=null;
相关文章推荐
- android database SQLite
- android ndk 入门3 - log实现
- Android开发实现距离位置变化
- 19条ANDROID平台设计规范(转)
- Android官方通信框架Volley:解析VolleyError获取包体信息
- Android 判断字符串是否相等
- Android小记:提升 Android 性能的建议
- android studio 快捷键!!!
- Android Fragment 真正的完全解析(上)
- 关于android布局的小知识
- Android中Service(服务)详解
- 【Android】弹出菜单popupmenu
- Android 进程的内存管理分析
- Android 时间选择器的原生态界面
- AndroidAnnotaions框架的使用
- Android开发技巧——使用PopupWindow实现弹出菜单
- android全屏去掉title栏的多种实现方法
- android:layout_weight的真实含义
- Android——终极版上拉刷新下拉加载(兼容ScrlooView、ListView、GridView以及各类布局)
- Android 高仿UC浏览器监控剪切板弹出悬浮窗功能