"The type Gallery is deprecated", Whats the best alternative?

22,534

It states in the docs:

This widget is no longer supported. Other horizontally scrolling widgets include HorizontalScrollView and ViewPager from the support library.

HorizontalScrollView will be closer to what you are looking for I think.

I suspect that Gallery was deprecated because it did not properly use convertView with its adapter. Which meant that it had to create a new view for every item which was a drain on performance.

Another option you have is to use the 3rd party created EcoGallery which Joseph Earl created to overcome the issue, this version does recycle its views properly. Unfortunately that pastebin link is the only reference to it I can find online now.

Share:
22,534

Related videos on Youtube

Omar
Author by

Omar

Updated on July 09, 2022

Comments

  • Omar
    Omar almost 2 years

    I was really surprised that such a Widget gets deprecated.
    I want a simple gallery that scrolls left and right, shows a picture on the whole Activity screen, and most important is that you cant swipe more than 1 image in any direction, even if the scroll speed is fast it changes to the next image.

    So which Widget should I use? Or should I use a simple ImageView and handle all the swipes and add an animation?