header-decor
header-decor copied to clipboard
Weird scrolling issue while using conditions in getHeaderId (GIF)
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.
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!
@hunter-isaiah96 try to return 0 instead of StickyHeaderDecoration.NO_HEADER_ID