I have a task - to create a grid of cells so that the right edge of the grid would connect to the left edge of the grid. So when the user scrolls right (or left) he would never reach the stop. That is similar how Earth rotates and I do not need 3D view but just plain 2D. Where should I start with that? Are there any articles on this subject?
1 Answers
Easiest way to make it is to customize the Adapter to make it "endless"
If you search online for things like "Endless Adapter" you'll comeup with a few examples
Here is a link to a Commonsware implemented one I didn't dig too deep but it looks like that might be more for a ListView than a GridView, but it could probably be modified to support GridView if so.
The overall idea is to make getSize() return Intenger.MAX, then in getItem() use position % actualSize
to determine which item you need to return. You'll have to keep track of the actual size yourself since you'll be overriding the built in method to do that so that it will return large number.
Additionally here is a different SO question dealing with this topic: Endless Gridview Commonsware has even provided an answer there that alludes to using his EndlessAdapter for this purpose.