PinnedHeaderListView
PinnedHeaderListView copied to clipboard
Pinned Section Header flickers
When scrolling slowly downward (and the new section header moves upward), the newly pinned header flickers out / disappears for a split second showing the old pinned header that it replaced. It quickly flickers back in and is correctly presented. This isn't noticeable generally when scrolling fast.
The next scrolling header (soon to become the pinned header) is being hidden and the pinned headerOffset is being reset to 0 BEFORE the scrolling header actually becomes the pinned header. Classic off-by-one bug. The fix is to wait until the pinned header is off the screen (or wait until the scrolling header becomes the pinned header) before hiding the scrolling header & reseting the headerOffset to 0:
PinnedHeaderListView.java:
120: if (pinnedHeaderHeight >= headerTop && headerTop >= 0) {\n
121: mHeaderOffset = headerTop - header.getHeight();
122: } else if (headerTop < 0) {
123: header.setVisibility(INVISIBLE);
124: }
Hello @btalberg,
- I just replaced the condition. Now it works perfect now. Thank you.