bgogetap / StickyHeaders

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

StickyHeaders with GridLayoutManager #52

Open ozv101 opened 7 years ago

ozv101 commented 7 years ago

It would be cool to implement this with GridLayoutManager. My app has a 2 column RecyclerView on landscape but I make the Header full width with the setSpanSizeLookUp. Check it out here https://stackoverflow.com/questions/26869312/set-span-for-items-in-gridlayoutmanager-using-spansizelookup

Might be a bunch of extra work but let me know if this is possible. This would make this library usable in many more scenarios.

bgogetap commented 7 years ago

This is absolutely something I'd love to support. I can't give any time frame on it, though.

There are a few gotchas that would have to be considered, though.

For example, would requiring headers to be full-span be a reasonable limitation? If not, this would greatly increase the difficulty of implementation as I would have to determine in which column the header appeared when adding it to the parent view to be sticky. Also, would a header from one column "push" a header that was stickied in another column? That would look a bit weird.

It would essentially require a completely different Positioner. So that would double the amount of work (new layout manager, new positioner).

Again, I think this is a valid request, but I don't know when I'd have time to look into it.

ozv101 commented 7 years ago

@bgogetap Yes, I think headers would have to be full span (full width of the RecyclerView). I can't actually think of a UI scenario where you would want two or more columns, but have the header NOT be full span. It would still push the header if it were full span. Ideally, the headers would work the same as with one column (LinearLayoutManager) except the non-header items would be in two or more columns.

hemanthnarayanan123 commented 5 years ago

Hi @bgogetap i have added a Pull Request for Grid Layout Manager. if you have some time and think it adds value to get it merged let me know.

but if you think its better that i fork and have my own repo for adding this functionality, feel free to let me know and i can do the same too :)