I need to have a certain layout, for example a CardView if I have only one item in my ArrayList of objects fed to the adapter.
However, if I have more than one item, I need to use another layout for the rows of the RecyclerView.
I know all about getItemViewType, but if the size of the ArrayList of objects fed to the adapter of my RecyclerView changes from 1 to 5, or from 5 to 1, I need to have the layouts change.
In this case OnCreateViewHolder will not be called again. (I want to avoid re-setting the adapter every time my dataset changes)
How do I have different layouts for a RecyclerView row based on size of my dataset?