ViewPager does not redraw content, remains/turns blank

前端 未结 13 908
萌比男神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 11:49

    For me the problem was coming back to the activity after the app process was killed. I am using a custom view pager adapter modified from the Android sources.The view pager is embedded directly in the activity.

    Calling viewPager.setCurrentItem(position, true);

    (with animation) after setting the data and notifyDataSetChanged() seems to work, but if the parameter is set to false it doesn't and the fragment is blank. This is an edge case which may be of help to someone.

提交回复
热议问题