Reputation: 39721
I'd like to create a gallery of photos that swipe left and right. At first I took a look at Gallery
, but it's marked as deprecated.
http://developer.android.com/reference/android/widget/Gallery.html
We're told to try ViewPager
instead. But the PagerAdapter
class doesn't handle recycling of views for us (like a standard ListView
), does it?
http://developer.android.com/reference/android/support/v4/view/PagerAdapter.html
Is it up to us to build the recycling mechanism?
Thanks
Upvotes: 5
Views: 7899
Reputation: 31
This HorizontalListView is great, i used it to do exactly what you want.
Upvotes: 2
Reputation: 46856
see the link in the edit on this question The link in the Edit, and the answers give you some possible ways to solve.
There is also a HorizontalListView
online somewhere if you search for it that makes a fine replacement for Gallery
and does recycle its views.
Upvotes: 1
Reputation: 8304
But the PagerAdapter class doesn't handle recycling of views for us (like a standard ListView), does it?
No, and I think it's because it was built assuming you are using different layouts for each of the page.
Also, as it is not being scrolled as fast as a ListView
(you cannot "fling" a ViewPager
to skip multiple pages), I think it doesn't need to have to recycle.
Upvotes: 3