ViewPager does not redraw content, remains/turns blank

前端 未结 13 900
萌比男神i
萌比男神i 2020-12-12 11:33

We\'re suffering from a very strange issue with ViewPager here. We embed lists on each ViewPager page, and trigger notifyDataSetChanged both on the list adapter and the view

相关标签:
13条回答
  • 2020-12-12 12:11

    I ran into this and had very similar issues. I even asked it on stack overflow.

    For me, in the parent of the parent of my view someone subclassed LinearLayout and overrode requestLayout() without calling super.requestLayout(). This prevented onMeasure and onLayout from being called on my ViewPager (although hierarchyviewer manually calls these). Without being measured they'll show up as blank in ViewPager.

    So check your containing views. Make sure they subclass from View and don't blindly override requestLayout or anything similar.

    0 讨论(0)
提交回复
热议问题