且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Android的解决GridView的滚动发行?

更新时间:2023-11-17 17:02:16

的ListView / GridView的重用意见。这意味着,你的情况是,当如你有1比萨,你向下滚动所以比萨消失,列表视图重用的视图出现的下一个视图,所以你会自动获得一个的产品:1 的被遗留下来的比萨的看法

ListView/GridView reuses views. What this means in your case is that when e.g. you have 1 Pizza, you scroll down so the Pizza disappears, the listview reuses that view for the next view that appears, so you'll automatically have a Items: 1 that was left over from the Pizza's view.

您有什么需要的就是将计为每个项目,并设置相应的tvCounter在getView。

What you need to to is store the count for every item and set tvCounter accordingly in getView.