开发者

Problems changing the style of certain items in a ListView

开发者 https://www.devze.com 2023-01-20 20:27 出处:网络
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 t

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

0

精彩评论

暂无评论...
验证码 换一张
取 消