Which approach is better while using recycler view? Is it better to have different view holders for different views or single view holder with all the different layouts defined in it and handling the visibility of layouts appropriately? And why the specified approach is better?
Asked
Active
Viewed 35 times
1 Answers
1
It is better to use multiple ViewHolders. Reasons are better memory performance because you don't have a bunch of unused fields and better reusability of the ViewHolders in other places.
If they share many fields you can create a BaseViewHolder
class that the others inherit from.

leonardkraemer
- 6,573
- 1
- 31
- 54