3

I found this example of how to use ViewPager and it's pretty simple to follow along. Now I'm wondering, can the ViewPager can show multiple views at the same time? If I have 10 items in the PagerAdapter can I have it show views 1, 2, and 3 first then when you swipe it moves over to 2,3,4; then 3,4,5; etc...

Nick
  • 4,556
  • 3
  • 29
  • 53

2 Answers2

0

After 6 years, now you can use RecyclerView and PageSnapHelper to achieve your goal.

HJWAJ
  • 170
  • 2
  • 10
0

The viewpager really only works with individual views. When view 1 is visible, swiping left would show part of view 1 and part of view 2. So I think the answer to your question is no.

However, another technique to try would be to layout views 1,2 and 3 into their our layout (view A). Then include views 3,4 and 5 in their own layout (view B). Then make the viewpager swipe back and forth between view A and view B.

I think this would achieve your goal.

AndroidGuy
  • 3,371
  • 1
  • 19
  • 21
  • That's not really what I want. That would make it show view 1, 2, and 3, then swiping left all 3 views are swiped off the screen and a second view 3 is shown with view 4 and 5. I read that ViewPager is supposed to work like listviews except they can contain other views and fragments, listviews do support multiple items on the screen at once so I keep thinking there's got to be a way to do this, maybe just with a different type of pager or adapter? – Nick Mar 07 '12 at 15:03