bgogetap / StickyHeaders

Easily add Sticky Headers to your RecyclerView
Apache License 2.0
521 stars 88 forks source link

Header jumps when user scroll up and higer header have more text than lower #44

Closed PiotrBandurski closed 7 years ago

PiotrBandurski commented 7 years ago

Hi! At first I would like to thank you for this super library :) I found a little bug which makes glitch as mentioned in title. To reproduce just replace com.brandongogetap.stickyheaders.demo.MainActivity#compileItems method with this code:

private static boolean doubler; private List<Item> compileItems() { List<Item> items = new ArrayList<>(); for (int i = 0; i < 100; i++) { if (i == 2 || (i % 4 == 0 && i > 0)) { doubler = !doubler; if (doubler) { items.add(new HeaderItem("Header at " + i, "header text header text header text header text header text header text header text header text header text")); }else { items.add(new HeaderItem("Header at " + i, "header text")); } } else { items.add(new Item("Item at " + i, "Item description at " + i)); } } return items; }

and then scroll to bottom and slowly scroll up. If this is not enough I can make a little video with this. Can I ask if this is little effort for you and can you fix this easily or I should fix it myself and then make pull request? Thanks!

bgogetap commented 7 years ago

Thanks for the sample code. I see what you mean.

I will look into maybe playing with visibility timing or something.

Only thing that worries me about your PR is the inefficiency of creating new view holders whenever the list is scrolling up.

PiotrBandurski commented 7 years ago

Yea, I made a fast fix because I need sticky headers asap :P. When official fix will be avaiable I will use your changes :)

bgogetap commented 7 years ago

Got this figured out I think. Will release fix in new version within the next few hours hopefully.