yanzm / LoopViewPager

LoopViewPager for Android
Apache License 2.0
186 stars 44 forks source link

Fragment and PageTransformer #3

Open saintsf opened 7 years ago

saintsf commented 7 years ago

Thanks for your LoopViewPager. It works very well with the old version. But I meet 2 issues with the new one. 1. I use FragmentStatePagerAdapter and 3 Fragments in my project. It will destroy the 1st Fragment and create a new one at the 4th page when scrolled to the 3rd page. (In the old LoopViewPager case, the 1st Fragment will not be destroyed but just appear at the 4th page.) 2. There's a bug with the PageTransformer when scrolling 3rd page to 4th page as the function transformPage(View view, float position) may pass in a wrong view or position, leading to a wrong transition effect.

saintsf commented 7 years ago

I have solved the 2nd issue by calling mLoopViewPager.indexOfChild(view) and mLoopViewPager.getChildCount() and view.bringToFront() in transformPage(View page, float position) to change the z-index of the view.