Can a ViewPager display more than one view at a time?

I found this example on how to use the ViewPager and it is quite simple to follow. Now I'm wondering if a ViewPager can show multiple views at the same time? If I have 10 items in the PagerAdapter, I can first show it 1, 2, and 3, and then when you swipe it will move to 2,3,4; then 3.4.5; etc...

+3


source to share


1 answer


The Viewpager really only works with selected views. When view 1 is visible, scrolling to the left will display part of view 1 and part of view 2. So I think the answer to your question is no.

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



I think this will accomplish your goal.

0


source







All Articles