android – RecyclerView vs. ListView

android – RecyclerView vs. ListView

RecyclerView was created as a ListView improvement, so yes, you can create an attached list with ListView control, but using RecyclerView is easier as it:

  1. Reuses cells while scrolling up/down – this is possible with implementing View Holder in the ListView adapter, but it was an optional thing, while in the RecycleView its the default way of writing adapter.

  2. Decouples list from its container – so you can put list items easily at run time in the different containers (linearLayout, gridLayout) with setting LayoutManager.


mRecyclerView = (RecyclerView) findViewById(;
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
mRecyclerView.setLayoutManager(new GridLayoutManager(this, 2));
  1. Animates common list actions – Animations are decoupled and delegated to ItemAnimator.

There is more about RecyclerView, but I think these points are the main ones.

So, to conclude, RecyclerView is a more flexible control for handling list data that follows patterns of delegation of concerns and leaves for itself only one task – recycling items.

For list views to have good performance youll need to implement the holder pattern, and thats easy to mess up especially when you want to populate the list with several different kinds of views.

The RecyclerView bakes this pattern in, making it more difficult to mess up. Its also more flexible, making it easier to handle different layouts, that arent straight linear, like a grid.

android – RecyclerView vs. ListView

ListView is the ancestor to RecyclerView. There were many things that ListView either didnt do, or didnt do well. If you were to gather the shortcomings of the ListView and solved the problem by abstracting the problems into different domains youd end up with something like the recycler view. Here are the main problem points with ListViews:

  • Didnt enforce View Reuse for same item types (look at one of the adapters that are used in a ListView, if you study the getView method you will see that nothing prevents a programmer from creating a new view for every row even if one is passed in via the convertView variable)

  • Didnt prevent costly findViewById uses(Even if you were recycling views as noted above it was possible for devs to be calling findViewById to update the displayed contents of child views. The main purpose of the ViewHolder pattern in ListViews was to cache the findViewById calls. However this was only available if you knew about it as it wasnt part of the platform at all)

  • Only supported Vertical Scrolling with Row displayed Views (Recycler view doesnt care about where views are placed and how they are moved, its abstracted into a LayoutManager. A Recycler can therefore support the traditional ListView as shown above, as well as things like the GridView, but it isnt limited to that, it can do more, but you have to do the programming foot work to make it happen).

  • Animations to added/removed was not a use case that was considered. It was completely up to you to figure out how go about this (compare the RecyclerView. Adapter classes notify* method offerings v. ListViews to get an idea).

In short RecyclerView is a more flexible take on the ListView, albeit more coding may need to be done on your part.

Leave a Reply

Your email address will not be published.