LoopingViewPager
LoopingViewPager copied to clipboard
OnPageChangeListener not working with viewpager as a listview row
I have a listview with rows containing a viewpager. this viewpager has a set of images like gallery.I want to retain the viewpager item, as the user scrolls up or down the listview.
I have tried it many times to make it work by setting the onpagechangelistner but OnPageChangeListener always defaults to zero when scrolling the listview which has the viewpager.
I tried to do the same thing with android.support.v4.view.ViewPager and that one works fine but does not have the looping capability.
Ok so I tried commenting the line which sets the current item to 0, in the setAdapter method of the LoopViewPager class and it seems to have solved the issue. When I set and adapter to my viewholder.pager, I do set the current item to my own default, so the change does not make problem for me. so far so good thanks
@Override public void setAdapter(PagerAdapter adapter) { mAdapter = new LoopPagerAdapterWrapper(adapter); mAdapter.setBoundaryCaching(mBoundaryCaching); super.setAdapter(mAdapter); //setCurrentItem(0, false); <--- this is the line I commented }