header-decor icon indicating copy to clipboard operation
header-decor copied to clipboard

Weird scrolling issue while using conditions in getHeaderId (GIF)

Open hunter-isaiah96 opened this issue 8 years ago • 2 comments

For example, if I use this simple condition to check(for simplicity)

if(task.getTitle().equals("Sticky Above This")){ return (long) position; } return StickyHeaderDecoration.NO_HEADER_ID;

When there are multiple items between a view, it produces this strange behavior

When I use return (long) position / 2 it shows a header every 2 items and scrolls just fine. I'm not 100% sure if it's me or the library but it would be nice to have a sense of direction.

hunter-isaiah96 avatar Jan 17 '17 06:01 hunter-isaiah96

If you're still facing a problem refer to this issue, helped me understand how the header id works :- https://github.com/edubarr/header-decor/issues/25

Basically, every cell ( whether the header is displayed immediately above that or not) needs a header id so you need not use the if condition at all ( in your sample code) instead return the same header id for every cell that belongs to a section ( a section being all the cells that are under a header). Hope this helps!

aditijoshi avatar Jan 25 '17 00:01 aditijoshi

@hunter-isaiah96 try to return 0 instead of StickyHeaderDecoration.NO_HEADER_ID

viktor1190 avatar Feb 06 '17 14:02 viktor1190