androidscrollcustom-viewcustom-scrolling

How to scroll "infinitely" wide view in Android?


I am pondering the alternatives on how to scroll an "infinite", scale-like, control in android. The simple idea is to redraw the entire view on each scroll movement, but somehow it doesn't seem like the proper way. It is possible to draw the contents before-hand, but I have no clue how wide I should make the view in the first place, and what happens when the user scrolls to the end of the view? I guess I need to extend the view towards that direction.

Should I go towards programatically adding (and removing) chunks of view to a linear layout? It would be great to hear what experiences are out there regarding drawing this kind of long-scrolling custom control.

Thanks /Erik


Solution

  • if you are working with list/grid or anything that uses Adapter for data, you can use a most excellent class written by CommonsWare and available here:

    http://github.com/commonsguy/cwac-endless

    it was was specifically for this purpose