Note that there are some explanatory texts on larger screens.

plurals
  1. POViewPager on Android 4.3 missing content
    text
    copied!<p>I have a <code>ListView</code> each item of which is <code>ViewPager</code> with some content (mostly images). Everything works fine bot not on Android 4.3 and above <code>ViewPager</code>'s content is missing and ViewPager not scrollable. I don't know which part of source code to provide here - ask me and I'll try to provide you maximum info.</p> <p>EDIT: Found out that ViewPager in my case has zero dimensions. But only on Android 4.3+.</p> <p>Here is part of my layout:</p> <pre><code>&lt;...AdaptableHeightImageView android:id="@android:id/icon" android:layout_width="match_parent" android:layout_height="wrap_content" android:adjustViewBounds="true" android:src="@drawable/slide" android:visibility="invisible" tools:ignore="ContentDescription" /&gt; &lt;...UninterceptableViewPager android:id="@+id/list_item_showcase_images" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignBottom="@android:id/icon" android:overScrollMode="never" /&gt; </code></pre> <p>When I set <code>ViewPager</code>'s width and height 100dp for example it becomes visible. The <code>UninterceptableViewPager</code> is <code>ViewPager</code> subclass with locked X-axes. The <code>AdaptableHeightImageView</code> is <code>ImageView</code> subclass which fits the setted width but stretches it's height to save aspect ratio. The goal is to have <code>ViewPager</code> with the same dimensions that <code>ImageView</code> has.</p> <p>If I write something like this:</p> <pre><code> &lt;...UninterceptableViewPager android:id="@+id/list_item_showcase_images" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignBottom="@android:id/icon" android:layout_alignLeft="@android:id/icon" android:layout_alignRight="@android:id/icon" android:layout_alignTop="@android:id/icon" android:overScrollMode="never" /&gt; </code></pre> <p>Then once my <code>Views</code> inside <code>ViewPager</code> or parent <code>ListView</code> are recycled they never appear again. Also in this case any <code>ViewPager</code> content which wasn't shown when data array is set will never be shown. But <code>ViewPager</code> will have dimensions and I even able to scroll it. Seems like Google changed something in Android 4.3.</p> <p>In conclusion: everything works fine only if I set concrete width and height</p>
 

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