How to avoid flickering while updating gridview?

前端 未结 9 2200
谎友^
谎友^ 2021-01-05 07:01

I have a gridview. Im displaying images from the array of 10 images. After 1 minute i\'m adding 5 more images. To update the gridview i\'m using the following code.

<
9条回答
  •  不知归路
    2021-01-05 08:03

    Simple solution is 1) Have a method in your adapter that will append/reset your new data list into old array list and not to call notifyDataSetChanged() When user will scroll getview will get called and hence list will be updated. It should not flicker.

    e.g. // Have a method in adapter class public void updateList(ArrayList list) { /enter code here`/add to old one oldList.addAll(list); }

    thats it `

提交回复
热议问题