PagerAdapter start position

前端 未结 9 1118

I\'m using the following example to impliment my viewPager: http://code.google.com/p/viewpagerexample/issues/list

The problem with this example is that I can\'t figure o

9条回答
  •  故里飘歌
    2021-01-30 08:44

    Using viewPager.setCurrentItem(newPosition); shows to the user the transition from the starting page to the newPosition, to prevent that from happening and show the newPosition directly as if it was the starting point, I added false to the second parameter something like this:

    int newPosition = pages.size()-1; // Get last page position
    
    viewPager.setCurrentItem(newPosition, false); // 2nd parameter (false) stands for "smoothScroll"
    

提交回复
热议问题