Reputation: 2249
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?
Upvotes: 6
Views: 2515
Reputation: 8907
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).
Upvotes: 0
Reputation: 39539
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
Upvotes: 1
Reputation: 67259
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
.
Upvotes: 6