Does a replacement for Gallery widget with View recycling exist?

后端 未结 5 557
情深已故
情深已故 2020-12-04 22:40

The default Gallery widget on Android does not recycle views - everytime the view for a new position is called the widget always calls the getView method of the

5条回答
  •  囚心锁ツ
    2020-12-04 23:30

    Super late to the party, but I've modified EcoGallery to do a few more things (and avoid some crashes).

    I've called it TimelineGallery and it's the same crap as the Gallery, but it can do smooth scroll and doesn't do weird stuff when images are loaded asynchronously.

    To demonstrate it, the sample uses Picasso and PullToRefresh.

    The original code, copyright and such belongs to Google so blame them for making such a crappy widget.

    Final note: I do not recommend using the gallery, it's old, buggy, hacky and will probably never be maintained. The problem is not about fixing its bugs, the problem is that the whole architecture of the Gallery is wrong and as such, fixing it is not possible without introducing more hacks.

    Google realized this and deprecated it. Use a ViewPager or a HorizontalScrollList and deal with the limitations of each.

    If you still want to go ahead and use this "gallery", feel free, it works, but it may crash your app and may frustrate you.

提交回复
热议问题