android / views-widgets-samples

Multiple samples showing the best practices in views-widgets on Android.
Apache License 2.0
5.03k stars 3.01k forks source link

[ViewPager2] itemCount > 3 , SwipeRefreshView can't work #217

Open 309152665 opened 3 years ago

309152665 commented 3 years ago

if ViewPager2 itemCount > 3 , such as 4 , ViewPager2 childs is SwipeRefreshView + RecyclerView , position 0 , pull refresh network data(before request SwipeRefreshView.isRefreshing = true , after network data complete , SwipeRefreshView.isRefreshing = false ) , fast switch to lastIndex , and switch back in a while , repeat the opera , sometimes the SwipeRefreshView can't pull refresh . if i set ViewPager2.offscreenPageLimit = 1 , it work well , but , when ViewPager2.itemCount = 4 , i must set ViewPager2.offscreenPageLimit = 2.......

https://user-images.githubusercontent.com/7857673/123208745-39184c80-d4f2-11eb-8ee2-86120832c8c8.mp4

the record SwipeRefreshView.isRefreshing=1 , some code : image image