How to solve scroll issue in GridView in android?

前端 未结 2 1314
礼貌的吻别
礼貌的吻别 2021-01-28 01:00

I am trying to develop a simple order app.

\"This

Here I want to add/cancel the product

2条回答
  •  渐次进展
    2021-01-28 01:14

    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.

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

提交回复
热议问题