0

I'm using Jake Wharton's viewpagerindicator. Because I want to use an infinite ViewPager, that means I only have 4 pages, but I set 400 pages for the pager. I use currId%4 to get the correct content to the pager. But now the question is, how can I set the indicators count by myself. Now there are 400 indicators below the ViewPager, which I only need 4 of them.

Thank you!

Vigor
  • 1,524
  • 2
  • 23
  • 41

1 Answers1

0

You can set this in your FragmentPagerAdapter inside getCount():

 @Override
    public int getCount() {
        return 4;
    }
Ahmad
  • 58,947
  • 17
  • 107
  • 133
  • To do this, I can't get the loop ViewPager. I want to loop the ViewPager, so I set a large number as the count of it. – Vigor Nov 23 '12 at 15:43
  • you mean this: http://stackoverflow.com/questions/10188011/how-to-make-a-viewpager-loop To use this method, I still have to set 6 as the pages count, not four. So the indicators number is still wrong. – Vigor Nov 23 '12 at 15:53
  • You want to loop trough the Viewpager, therefore you are setting your count to 400? WHY? just implement a OnPageChangeListener() and set your ViewPager to the first item when scrolling trough the last. – Ahmad Nov 23 '12 at 15:53