

MultiViewAdapter solves all of these requirements. You have to write switch cases, if you want to have different item-decorations/span-size/selection-modes for different view types.So you can’t use the same layout file for two different view types. Usually layout resource ID is returned as a view type. You are allowed to manage the view type ID yourself.You are forced to keep layout resource ID inside the model class itself.Your data objects should have a common parent, which can interfere with your object modeling.There are a number of solutions available already, but such libraries have a few restrictions: MultiViewAdapter is meant to solve this exact problem. Unfortunately, there is no easy way to reuse the creation and binding code of viewholders. You may have multiple if-else conditions, switch cases, and so on. It can quickly get out of hand if you have more than three viewtypes. But displaying multiple viewtypes requires a lot of boilerplate code. The support for multiple viewtypes was one of the advantages of RecyclerView over legacy listview. However, because of this flexibility, there’s a bit of work involved to create an adapter. It’s a powerful tool that covers many generic use-cases. RecyclerView is an important widget in the Android framework and a large percentage of the Android apps out there use it. By Riyaz Ahamed Create Android Recyclerview adapters like a boss with MultiViewAdapter Library for creating composable recyclerview adapters
