0

I want to swipe view pager in both direction with infinite rotations. For example When swipe right then 1->2->3->1->2. So on When swipe left then 1->3->2->1->3. So on

Tabassum Latif
  • 227
  • 2
  • 14

1 Answers1

3

There is a library maybe help you

dependencies {
    compile 'com.antonyt.infiniteviewpager:library:1.0.0'
}

In your layout

<com.antonyt.infiniteviewpager.InfiniteViewPager
    android:id="@+id/pager"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" />

In your code, wrap your existing PagerAdapter with the InfinitePagerAdapter

PagerAdapter wrappedAdapter = new InfinitePagerAdapter(adapter);
viewPager.setAdapter(wrappedAdapter);

But this library just working when you have at least 4 pages. More info link github library

Fuyuba
  • 190
  • 1
  • 8