Skip to content Skip to sidebar Skip to footer

Offscreen Viewpager Fragments Won't Render After 1st Time Loaded

I have a viewpager with 5 tabs and if I go to the 5th fragment(that is the fragment loaded when I click the 5th tab or swipe to the 5th tab) and then I go to the 3rd tab the 5th fr

Solution 1:

I finally figured it out! I had these lines of code

vpager.setPageTransformer(false, newViewPager.PageTransformer() // page swipe animations
    {
        @OverridepublicvoidtransformPage(View page, float position)
        {
            intpageWidth= page.getWidth();
            intpageHeight= page.getHeight();

            if (position < -1)   // [-Infinity,-1)
            {
                // This page is way off-screen to the left.
                page.setAlpha(1);
            }
            elseif(position <= 1)    // Page to the left, page centered, page to the right
            {
                // modify page view animations here for pages in view
            }
            else// (1,+Infinity]
            {
                // This page is way off-screen to the right.
                page.setAlpha(0);
            }
        }
    });

and I simply commented them out. I guess I should have posted that but I had no idea it could interfere with pages not loading.

Post a Comment for "Offscreen Viewpager Fragments Won't Render After 1st Time Loaded"