Devlight / InfiniteCycleViewPager

Infinite cycle ViewPager with two-way orientation and interactive effect.
Apache License 2.0
5.75k stars 827 forks source link

Disappearing fragments in HorizontalInfiniteCycleViewPager #20

Open ahmadeqbal opened 7 years ago

ahmadeqbal commented 7 years ago

i'm using HorizontalInfiniteCycleViewPager in my application with 5 fragments. the issue is when i'm scrolling backwards (only backwards) after 2 scrolls everything is disappeared and i should scroll 5 times again in backwards to reveal fragments again. i'v tried FragmentStatePagerAdapter and FragmentPagerAdapter for my adapter but got nothing.

GIGAMOLE commented 7 years ago

Hello. Thanks for issue. Did you saw this problem in sample app?

ahmadeqbal commented 7 years ago

Hi haven't tried sample app i'm using my own

GIGAMOLE commented 7 years ago

Try it pls.

ahmadeqbal commented 7 years ago

sample app is working fine. thank you for your awesome library

GIGAMOLE commented 7 years ago

So. Try to set all settings like in sample app. Thanks.

khalodark commented 7 years ago

Hi GIGAMOLE I tried your samples, but none of them solved the problem titled here. the main problem of Disappearing fragments in HorizontalInfiniteCycleViewPager does exist, my viewpager returns fragments each on its own (every fragment is different from the other) but when press backward the fragment is disappearing ! which sample you told to try, I tried them all!

khalodark commented 7 years ago

any answer yet ?

mspapant commented 7 years ago

any news?

vietnx92 commented 7 years ago

just comment //page.setVisibility(View.GONE); in function: public void transformPage(final View page, final float position){//...} in inner-class public void processAttributeSet(final AttributeSet attributeSet){//...} file InfiniteCycleManager.class

Fjnova commented 5 years ago

I got this issue when creating page by code like this: // final VerticalInfiniteCycleViewPager infiniteCycleViewPager = new VerticalInfiniteCycleViewPager(context) final HorizontalInfiniteCycleViewPager infiniteCycleViewPager = new HorizontalInfiniteCycleViewPager (context)

I resolved by adding default settings like: infiniteCycleViewPager.setAdapter(...); infiniteCycleViewPager.setScrollDuration(500); infiniteCycleViewPager.setInterpolator(...); infiniteCycleViewPager.setMediumScaled(true); infiniteCycleViewPager.setMaxPageScale(0.8F); infiniteCycleViewPager.setMinPageScale(0.5F); infiniteCycleViewPager.setCenterPageScaleOffset(30.0F); infiniteCycleViewPager.setMinPageScaleOffset(5.0F); infiniteCycleViewPager.setOnInfiniteCyclePageTransformListener(...);

I did not see any note about setting is mandatory.

Anyway, Thanks for the awesome library

jary163 commented 4 years ago

the fragment will circle use,so .you must get View with fragment。like this

        override fun instantiateItem(container: ViewGroup, position: Int): Any {
            val normallFragment = NormallFragment().apply { arguments = Bundle() }
            val itemView = normallFragment.onCreateView(LayoutInflater.from(container.context), container, null)
            container.addView(itemView)
            return itemView!!
        }

        override fun destroyItem(container: ViewGroup, position: Int, oc: Any) {
            container.removeView(oc as View)
        }