/horizontalpager

An Android horizontally scrolling view that snaps to child pages neatly and supports nested vertically scrolling child views.

Primary LanguageJava

HorizontalPager for Android

((NOTE)) This library is obsoleted by Google's release of their own ViewPager library as part of the Android Compatibility Package, revision 3. I would recommend using that for any new development.

HorizontalPager is a modified version of Marc Reichelt's RealViewSwitcher. It's essentially a horizontal ScrollView that snaps to a full-width child (like the Android homescreen's switching behavior). This modified version supports vertically scrolling children inside the view (Lists, vertical ScrollView children), animates a little more quickly and consistently to views regardless of how "far away" a child is when the animation is requested, scrolls a bit more easily, and is screen-density-neutral regarding swipe sensitivity. It also includes a demo of how you can nest vertically scrolling elements inside the pager and use a RadioGroup as a tablike controller to switch pages (somewhat like the Android 2.0+ News widget). There's a simple demo to get you started in addition to the more complex one with an XML layout), or just grab the PageSwitcher class, drop it into your app, and get rolling.

PageSwitcher screenshot

License

Like Marc's original, this modified version is released under an Apache 2.0 license.