When the RecyclerView is expected to show more than 5 views on the screen at the same time (5 is the current default), it's recommended to enlarge it to what you think will be the max. This will allow to do an actual recycling (the purpose of RecyclerView...) when scrolling, to avoid re-creation of Views.
In fact, because I actually think that it's almost never known how many will be be shown on the screen (different screens resolutions, etc...) , I think it's best to just set it to be the max :
fun RecyclerView.setMaxViewPoolSize(maxViewTypeId: Int, maxPoolSize: Int) {
for (i in 0..maxViewTypeId)
recycledViewPool.setMaxRecycledViews(i, maxPoolSize)
}
Usage:
recyclerView.setMaxViewPoolSize(MAX_TYPE_FOR_THE_ADAPTER_YOU_MADE, Int.MAX_VALUE)
I personally don't understand why it's not the default behavior. The whole point of using a RecyclerView is to recycle the Views. When scrolling, it should, by default, recycle views that were just used.