问题改变某些项目的风格在ListView [英] Problems changing the style of certain items in a ListView

查看:110
本文介绍了问题改变某些项目的风格在ListView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有TextViews的ListView和强调其中的一个,我想使TextView的粗体即可。这只如果我不滚动的ListView的作品。我滚动之后,大胆改变到不同的位置。没有人知道为什么,或者我怎么能解决这个问题?

I have a ListView of TextViews and to highlight one of these, I want to make the TextView bold. This only works if I don't scroll the ListView. After I scroll, the boldness changes to a different position. Does anyone know why, or how I can solve this problem?

推荐答案

这可能与ListView的问题,因为列表视图重用视图中的项目(并往里面它们的内容),如果你使用的是convertView功能。很难没有看到你的code,哪里就有奇迹错误的说法。你可以尝试使用HTML类来处理所需物品的气魄:

It may be problem with ListView, because listview reuses view items (and puts content inside them), if you are using convertView feature. It's hard to say without seeing your code where it goes wrong. You could try using Html class to handle the boldness of required items:

txt.setText(Html.fromHtml('<b>Text that requires bold</b>'));

这篇关于问题改变某些项目的风格在ListView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆