castorflex / VerticalViewPager

Copy pasted version of the support ViewPager, but vertical!
1.11k stars 305 forks source link

setOnPageChangeListener doesn't work #19

Closed raychenon closed 8 years ago

raychenon commented 8 years ago

It is the same as https://github.com/castorflex/VerticalViewPager/issues/6 In combination with ViewPagerIndicator , the VerticalViewPager's OnPageChangeListener is not working.

verticalViewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener()...);
verticalCirclePageIndicator.setViewPager(verticalViewPager);
raychenon commented 8 years ago

After reading this https://github.com/JakeWharton/ViewPagerIndicator/issues/310 , I solved the trouble. Set OnPageChangeListener to ViewPagerIndicator not to the VerticalViewPager.

viewPager.setAdapter(fragmentPagerAdapter);
pageIndicator.setOnPageChangeListener(new ViewPager.OnPageChangeListener()...);
pageIndicator.setViewPager(viewPager);