Problems changing the style of certain items in a ListView

最后都变了- 提交于 2019-12-11 10:09:48

问题


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?


回答1:


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>'));



回答2:


Not right offhand. I would recommend posting some code; the problem sounds like it may be in your implementation



来源:https://stackoverflow.com/questions/3979725/problems-changing-the-style-of-certain-items-in-a-listview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!