StickyListHeaders icon indicating copy to clipboard operation
StickyListHeaders copied to clipboard

ExpandableStickyListHeadersListView - performance suffers when collapsed

Open asgarddesigns opened this issue 10 years ago • 4 comments

Because items are hidden rather than recycled, they cause some significant performance degradation.

Is this easily solved?

asgarddesigns avatar Nov 26 '14 00:11 asgarddesigns

Any solution for this?

sarn avatar Apr 21 '16 14:04 sarn

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 avatar Apr 21 '16 23:04 asgarddesigns

@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.

ProfPh avatar Jun 14 '17 02:06 ProfPh

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.

asgarddesigns avatar Jun 14 '17 04:06 asgarddesigns