RecyclerView was introduced in Android 5.0 Lollipop and was defined by Google as a more flexible and advanced version of
ListView. It is based on an
Adapter class similar to
ListView, but it enforces the use of a
ViewHolder class to improve performance and modularity, as we have seen in the previous section. The flexibility comes in when we decouple the item representation from the component and allow animations, item decorations, and layout managers to do the work.
RecyclerView handles the adding and removing of animations using
RecyclerView.ItemAnimator, which we can subclass to customize the animations. If you display data from a source or if the data changes, for instance by adding or removing items, you can ...