https://developer.android.com/develop/ui/views/layout/recyclerview
RecyclerView makes it easy to efficiently display large sets of data. You supply the data and define how each item looks, and the RecyclerView library dynamically creates the elements when they're needed.
As the name implies, RecyclerView recycles those individual elements. When an item scrolls off the screen, RecyclerView doesn't destroy its view. Instead, RecyclerView reuses the view for new items that have scrolled onscreen. RecyclerView improves performance and your app's responsiveness, and it reduces power consumption.
Note: RecyclerView is the name of both the class and the library that contains it. On this page, RecyclerView in code font always means the class in the RecyclerView library.
Several classes work together to build your dynamic list.
RecyclerView is the ViewGroup that contains the views corresponding to your data. It's a view itself, so you add RecyclerView to your layout the way you would add any other UI element.RecyclerView binds it to its data. You define the view holder by extending RecyclerView.ViewHolder.RecyclerView requests views, and binds the views to their data, by calling methods in the adapter. You define the adapter by extending RecyclerView.Adapter.LayoutManager abstract class.You can see how all the pieces fit together in the RecyclerView sample app (Kotlin) or RecyclerView sample app (Java).
If you're going to use RecyclerView, there are a few things you need to do. They are explained in detail in the following sections.
ViewHolder class. Your version of ViewHolder provides all the functionality for your list items. Your view holder is a wrapper around a View, and that view is managed by RecyclerView.Adapter that associates your data with the ViewHolder views.There are also advanced customization options that let you tailor your RecyclerView to your exact needs.
The items in your RecyclerView are arranged by a LayoutManager class. The RecyclerView library provides three layout managers, which handle the most common layout situations: