ViewPager + Adapter in Fragment => laggy swiping

前端 未结 2 1736
滥情空心
滥情空心 2020-12-28 20:46

I have a ViewPager with some fragments. Each fragment has a ListView in a SlidingDrawer (=invisible before swiping) with an Arra

2条回答
  •  悲哀的现实
    2020-12-28 21:31

    My Question is, wether it is possible to set the Adapter after swiping when it Pager is idle?

    There is the OnPageChangeListener that you could set on the ViewPager to monitor the swipe gestures. You could then use the onPageSelected()(or the onPageScrollStateChanged() to monitor the current state) method to get notified when a new page has been selected and start from that method the loading of data.

    Also, make sure the ListView are responsible for the lag and not some other part of your code.

提交回复
热议问题