Note that there are some explanatory texts on larger screens.

plurals
  1. POViewPager + PagerAdapter shows blank pages after first two items
    primarykey
    data
    text
    <p><strong>What's happening</strong>: The first two ViewPager pages loaded nicely (ViewPager automatically loads +-1 from current page). When you scroll past these the next pages aren't showing up. GIF demo of the problem below.</p> <p><strong>Debug info</strong>: The pages <em>are</em> being instantiated (see code below) and are successfully added to the ViewPager <code>ArrayList&lt;ItemInfo&gt;mItems</code> (confirmed via Log messages). I recompiled the <code>android.support.v4</code> library with debug=true set (<code>mmm frameworks/support/v4/</code> in aosp) and it shows everything working perfectly EXCEPT:</p> <p>The onLayout and onMeasure methods in ViewPager stop being called after the first two views are loaded. This means the other pages are black because they were never measured&amp;arranged as they should have been. I tried adding different requestLayout() calls at different points to force a layout tree refresh to no avail. </p> <p><strong>Background</strong>: I have a ViewPager instantiated via inflater.inflate and found via view.findViewById(R.layouy.myid). It's directly replacing an old Gallery view, and for testing purposes the PagerAdapter instantiateItem(collection, position) simply does this:</p> <pre><code>@Override public Object instantiateItem(View collection, final int position) { final TextView tv = new TextView(collection.getContext()); tv.setText("Looking at page " + position); tv.setTextColor(Color.WHITE); tv.setBackgroundColor(Color.rgb( (int)(Math.random()*100), (int)(Math.random()*100), (int)(Math.random()*100))); tv.setTextSize(22); ((ViewPager) collection).addView(tv); return tv; } </code></pre> <p>Any ideas? It looks to me like some mystery setting in PageView's parents are somehow disabling onLayout PageView</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload