See my more recent answer here: Can a ViewPager have multiple views per page?
I found that an even simpler solution is possible by specifying a negative margin for the ViewPager. I created a MultiViewPager project on GitHub, which you can look at:
https://github.com/Pixplicity/MultiViewPager
Although this question specifically requires a solution without an edge effect, some answers here offer a workaround for CommonsWare, such as the kaw suggestion.
There are various problems with touch controls and hardware acceleration with this particular solution. A simpler and more elegant solution, in my opinion, is to specify a negative field for the ViewPager:
ViewPager.setPageMargin( getResources().getDimensionPixelOffset(R.dimen.viewpager_margin));
Then I specified this dimension in my dimens.xml :
<dimen name="viewpager_margin">-64dp</dimen>
To compensate for overlapping pages, each page view has the opposite edge:
android:layout_marginLeft="@dimen/viewpager_margin_fix" android:layout_marginRight="@dimen/viewpager_margin_fix"
Again in the dimens.xml :
<dimen name="viewpager_margin_fix">32dp</dimen>
(Note that the size of viewpager_margin_fix is half the size of the absolute viewpager_margin .)
We applied this in an application for the Dutch newspaper De Telegraaf Krant :


Paul Lammertsma Jan 20 '14 at 16:27 2014-01-20 16:27
source share