Problems changing the style of certain items in a ListView
I have a ListView of TextViews and to highlight one of th开发者_开发知识库ese, 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?
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>'));
Not right offhand. I would recommend posting some code; the problem sounds like it may be in your implementation
精彩评论