InfiniteViewPager viewPager = ...; viewPager.setOnInfinitePageChangeListener(new InfiniteViewPager.OnInfinitePageChangeListener() { @Override public void onPageScrolled(Object indicator, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(Object indicator) { } @Override public void onPageScrollStateChanged(int state) { } });In general it is not very different from the regular ViewPager.OnPageChangeListener. The callback methods
onPageSelected(final Object indicator)and
onPageScrolled(Object indicator, float positionOffset, int positionOffsetPixels)return the current indicator instead of position.
You can bind it with maven:
<dependency> <groupId>com.thehayro</groupId> <artifactId>infiniteviewpager</artifactId> <version>0.4</version> <type>apklib</type> </dependency>
The code can be found here.
No comments:
Post a Comment