4

I've been looking for a while and I can not find a clear, straightforward ViewPager example that works. I think others are having the same problem and I want to know. I know there are other questions about them but I've tried the websites are they are either out of date or crash.

jacobohunter
  • 363
  • 1
  • 4
  • 16
  • Which ones have you tried, and what specifically doesn't work with them? What problems are others having? – shenles Oct 10 '12 at 16:29

1 Answers1

4

I've been looking for a while and I can not find a clear, straightforward ViewPager example that works

Here is one that uses ViewPager with a FragmentPagerAdapter.

Here is one that is the same as the above, with the addition of a PagerTabStrip.

Here is one that uses tabs in the action bar instead of a PagerTabStrip.

The gist of all is the same:

  • Add a ViewPager to an activity layout
  • Create some sort of PagerAdapter that will return the pages
  • Attach the adapter to the pager
CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • How do I just get the code JUST for the Viewpager because all the packages are separated and it's getting frustrating trying to get the code. – jacobohunter Oct 20 '12 at 19:40
  • @JacobBrans: `ViewPager` is in the Android Support package, available from your SDK Manager. – CommonsWare Oct 20 '12 at 23:31
  • @CommonsWare Can you please have a look at my question regarding View pager http://stackoverflow.com/questions/15895554/rendering-views-to-view-pager-optimized-way – Ashish Dwivedi Apr 09 '13 at 08:56