JimiSmith / PinnedHeaderListView

A ListView with pinned section headers for Android
663 stars 306 forks source link

Pinned Section Header flickers #17

Open psocial opened 10 years ago

psocial commented 10 years ago

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.

btalberg commented 10 years ago

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:        }
tneginareb commented 9 years ago

Hello @btalberg,