StickyListHeaders
StickyListHeaders copied to clipboard
ExpandableStickyListHeadersListView - performance suffers when collapsed
Because items are hidden rather than recycled, they cause some significant performance degradation.
Is this easily solved?
Any solution for this?
We mostly moved to recyclerviews and treated the list as a flat list with different view types. when you expand, insert the items after the header item, when collapsed, remove them all.
It's a bit of work, but the only way to maintain performance.
@asgarddesigns Do you have the code for your adaptation available online?
The root of the issue is all of the Views in a collapsed header being drawn and handled in ListView.fillGap
(this can be seen with the way the scrollbar changes as it scrolls over a collapsed section). If this were skipped somehow, where the Views are not drawn until header expanded again, then performance would improve dramatically.
Unfortunately not @ProfPh , I've moved on from that job so can't even access it now. From memory it shouldn't be hard to replicate:
- single recyclerview
- configure for multiple viewtypes (see https://guides.codepath.com/android/Heterogenous-Layouts-inside-RecyclerView for an example)
- onItemClick will insert/remove the expanded items into the master list at the correct index
Sorry, this is all from memory so I may be missing things, but that was, in essence, the method of doing it. The whole thing was a bit of a PITA but performance improved dramatically and there was far fewer nasty side-effects.