Continuously scrolling Gallery?
-
06-02-2021 - |
Frage
I have a Gallery object that scrolls from left to right and back again. However, I would like to make this Gallery circle back on itself, that way when I get to my last View, the very first one is next and I can just keep scrolling. Any ideas? Thanks.
Lösung
Galleries use an Adapter to back the data that they display. You can create a custom adapter where getCount()
returns Integer.MAX_VALUE and getView()
does a modulos the position with the number of images you have. This way it always returns the appropriate image for a given position.
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow