RecyclerView Basics
Display large lists efficiently with RecyclerView. Create an Adapter, ViewHolder, and connect data using ViewBinding.
Why RecyclerView?
RecyclerView is the standard way to display a scrollable list of items in Android.
Unlike the older ListView, RecyclerView:
- Recycles views as you scroll — only creates as many as fit on screen
- Works for vertical lists, horizontal lists, and grids
- Is highly customizable with LayoutManagers
RecyclerView Architecture
RecyclerView needs three pieces to work:
- RecyclerView — the widget in your layout XML
- Adapter — binds your data to item views
- ViewHolder — holds references to the views inside each list item
The Adapter creates ViewHolders and binds data to them as the user scrolls.