Problems changing the style of certain items in a

2019-07-28 05:29发布

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?

2条回答
放荡不羁爱自由
2楼-- · 2019-07-28 06:14

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>'));
查看更多
看我几分像从前
3楼-- · 2019-07-28 06:27

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

查看更多
登录 后发表回答