“The type Gallery is deprecated”, Whats the best alternative?

后端 未结 1 1789
无人及你
无人及你 2020-12-09 17:16

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 im

相关标签:
1条回答
  • 2020-12-09 17:39

    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.

    0 讨论(0)
提交回复
热议问题