0

I wanted to know when I should use RecyclerView over List View or ListView over RecyclerView and what difference does it make? I have used them both and I know for implementing we use a ViewHolder for RecyclerView. My question is specific to their inner implementation and performance of them over one another.

Edit: My question is that is there any place where ListView can be advantageous over RecyclerView? If not then why hasn't it been marked as depreciated by Google. Also, while we may find the ListView in the android:support library which is present by default if we create a new projec but for using RecyclerView we have to use another dependency.

  • The name suggests that the RecyclerView would be smaller and more performant in the case of long lists. But that's me guessing. – cHao Jul 05 '18 at 16:16

1 Answers1

2

The names are very descriptive in this case.

The ListView has been designed to display vertical lists of similar items. Its design however has one flaw, it is easy for developers to write not optimal ListViews which can result in slow, lagging scrolling of large amounts of items. The mentioned flaw has been addressed with the popular ViewHolder pattern.

The RecyclerView has been designed as a general purpose container of large amounts of items, which can be displayed as lists, grids or whatever you imagine and implement. The RecyclerView is considerably newer than the old ListView, this allows it to benefit with a few extras as default animations on items for free. The devil, in this case, is in the "general purpose" thing. The RecyclerView in most cases requires to write more code for simple things that would be required for the ListView. The extra complexity of the RecyclerView however, pays back in more advanced use cases.

More on the subject: RecyclerView vs. ListView