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:
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 theRecycleView
it's the default way of writing adapter.Decouples list from its container - so you can put list items easily at run time in the different containers (linearLayout, gridLayout) with setting
LayoutManager
.
Example:
mRecyclerView = (RecyclerView) findViewById(R.id.my_recycler_view);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
//or
mRecyclerView.setLayoutManager(new GridLayoutManager(this, 2));
- 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.
Why does Recycler View offers a better experience than List View?
The RecyclerView
widget is a more advanced and flexible version of ListView
.
RecyclerView
was created as aListView
improvement,- In the
RecyclerView
model, several different components work together to display your data. The overall container for your user interface is aRecyclerView
object that you add to your layout. RecyclerView
drastically improve performance- The
RecyclerView
fills itself with views provided by a layout manager that you provide. - Advantages of
RecyclerView
is- Efficiently Reuses cells while scrolling up/down
- Decouples list from its container
- Animations are decoupled and delegated to
ItemAnimator
- 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
Related Topics
Android Camera Preview Stretched
Calculate Compass Bearing/Heading to Location in Android
Scroll Recyclerview to Show Selected Item on Top
How to Get the Height and Width of the Android Navigation Bar Programmatically
How to Build an Executable for Android Shell
"Gradle Version 2.10 Is Required." Error
Reference One String from Another String in Strings.Xml
Get Referrer After Installing App from Android Market
Android Popup Window Dismissal
Play Audio File from the Assets Directory
Android Spinner with Multiple Choice
Android: Out of Memory Exception in Gallery