how to make my viewpager swipe from right to left

It is the very simple technique to change the swipe direction of the Viewpager.

There are two simple step which has to follow you,

1. Change the rotation of the View pager,

viewpager.setRotationY(180);

2. Then again change the direction of the fragment container which is the child of viewpager,

recyclerView.setRotationY(180);

Note: In my case, I have used recyclerview as the child of the view pager.

This is 100% worked for me.


You can swipe in both directions already. By default it shows page zero, but you could change that:

protected void onCreate(Bundle savedInstanceState) {
    // ...
    viewPager.setCurrentItem(myFragmentCount-1); 
    // ...

I think you can set current page to the last page using viewPager.setCurrentItem(). Then it will swipe left to right .. :)