简体   繁体   中英

Android Recycler View: How to stop loading of images when recycler view is scrolling and start loading only when scroll is stopped?

如何在回收站视图滚动时停止加载图像并仅在滚动停止时才开始加载?

A common application feature is to load automatically more items as the user scrolls through the items (aka infinite scroll). This is done by triggering a request for more data once the user crosses a threshold of remaining items before they've hit the end.

The approaches for ListView, GridView and RecyclerView (the successor to ListView) are documented here. Both are similar in code except that the LayoutManager in the RecyclerView needs to be passed in to provide the necessary information to implement infinite scrolling.

Follow this link for more implementation details:

https://guides.codepath.com/android/Endless-Scrolling-with-AdapterViews-and-RecyclerView

The question is slightly unclear, but I'm going to assume that you are talking about loading images into an imageview in recyclerview/listview items.

Answer: Don't do it by hand. Use a library (like Glide ) to load the images for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM