简体   繁体   中英

Few questions about RecyclerView

So far I was using ListView in my apps. It was simple to implement. Now I decided to use RecyclerView for my next project. This app is supposed to retrieve some data as JSON from a web service. This data included a title, some text and an image.

So here are my questions:

  • Is there any way to lazy load images in RecyclerView?
  • Does RecyclerView reduce memory usage when data set is large?
  • Is it possible to use SwipeRefreshLayout (Pull to refresh) with RecyclerView?

Android is an evolving platform. Recently 5.0 (Lollipop) version of Android was released, along with the official RecyclerView support v7 library . As per the official documentation RecyclerView is a major enhancement over ListView .

  • Is there any way to lazy load images in RecyclerView? Yes
  • Does RecyclerView reduce memory usage when data set is large? I think Yes
  • Is it possible to use SwipeRefreshLayout (Pull to refresh) with RecyclerView? Yes

Please check Android-Universal-Image-Loader . It has memory cache, disk cache and it loads your images asynchronously so doesn't DESTROY the Memory. You can set default image and/or failed to fetch image etc. It can sample down your image to decrease the memory footprint of the bitmap.

RecyclerView is indeed a powerful view than ListView .

SwipeRefreshLayout

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