When to use ListView instead of RecyclerView
Asked Answered
J

3

6

I've been reading about RecyclerView and it's advantages over ListView And I got the difference between them.

What I don't get is when to use ListView and when to use RecyclerView. And is the RecyclerView meant to replace ListView? Do I have to replace all my ListViews with RecyclerViews?

Janis answered 9/2, 2015 at 15:20 Comment(2)
"when to use ListView and when to use RecyclerView" -- if you need some of the advanced capabilities of RecyclerView (e.g., animated effects as you add/remove items), use RecyclerView. "Do I have to replace all my ListViews with RecyclerViews?" -- no.Aleen
check the thread: Should we use RecyclerView to replace ListView?Sonorous
C
6

is the RecyclerView meant to replace ListView?

Yes.

Do I have to replace all my ListViews with RecyclerViews?

No.

What I don't get is when to use ListView and when to use RecyclerView.

My recommendation is to use only RecyclerView for lists going forward. It is meant as a replacement for ListView, and it is a fantastic one at that. I would expect RecyclerView to continue to receive updates, but ListView will likely remain more or less as it is right now.

ListView isn't going anywhere because there are far too many applications that use it. Google can't just remove it because that would prevent most existing apps from compiling with the latest SDK. Deprecating it also isn't ideal because converting a ListView to a RecyclerView is a non-trivial amount of work and there isn't anything particularly broken with ListView.

Cosentino answered 9/2, 2015 at 15:25 Comment(1)
Hi Tanis, could you please check my question Should we use RecyclerView to replace ListView? and give comprehensive answerSonorous
S
1

RecyclerView is the successor of ListView - so you should use it for all new code - but there is no immanent need to replace all ListViews now

Stygian answered 9/2, 2015 at 15:25 Comment(0)
P
0

For me, ListView is more used in functional scenario, because it has built-in setOnItemClickListener() and setMultiChoiceModeListener() (multiselection mode), which are lack of in RecyclerView. On the other hand, RecyclerView is more used in display scenario, because it supports drag and drop funcitonality (built-in animation).

Passbook answered 20/12, 2019 at 21:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.