I know it's a bad idea, but I'm using a RecyclerView inside another RecyclerView's item to display a list of items containing a list.
I managed to get it work and tweaked it as far as I could, but I still get those green
spikes when lists with a bigger number of items begin to show and are being drawn on the screen.
Those spikes produce a noticeable lag when flinging through items and are even more obvious when using something slower and older than Samsung Galaxy S6.
I did some logging, and it appears that the outer
ViewHolders are being recycled and the inner
RecyclerView's adapter is created only 5 times so it must be the drawing time that kills the performance.
I've managed to limit the creation of new inner
RecyclerView's ViewHolders by setting the maximum number of ViewHolders in the RecycledViewPool but that helped only a little.
I know that the inner RecyclerView doesn't have a "bottom" on which it could rely to calculate when to show new items so it has to draw every item immediately and that is probably the main reason why one shouldn't use this setup. (I come to my senses as I write this question.. thank you rubber ducks of the world).
Is there a way this could be tweaked even further or could you suggest how to make this work using some different setup other than RecyclerView inside another RecyclerView's item?
I will provide more info if needed.
Thank you