bgogetap / StickyHeaders

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

Want to be able to use headers that does not have a background. #79

Open woxblom opened 6 years ago

woxblom commented 6 years ago

Hey and thanks for a great lib!

I have a feature request. I want to be able to use headers that do not have a background. Like a header with just text for example. Atm the item in the list in always shown and the header is put on top to "hide" the list item below. But if I don't want a background on the header then the list item beneath will show at the same time as the header.

Would it be possible for you to make a change so the items in the list turn invisible when its header is attached?

screenshot_1534167225

Cheers! Magnus

bgogetap commented 6 years ago

What about the other items scrolling behind it? That would look weird as well.

I think an easier solution would be to add an optional interface that ViewHolders could implement that will have a method called when the ViewHolder is used as a sticky header. In that case you could add/"turn on" a background when that specific item is stickied.

If you really want even the stickied item to have no background, let me know and I can think more on it.

woxblom commented 6 years ago

Well my scenario exactly is like this.

I want the sticky header to be a text centered in the middle with a background with rounded corners. The issue I see now is that since it is with rounded corners and has a padding from top you will see the real item in the list scroll out/in when the sticky header becomes visible.

See attached image, here the "Header at 2" in the real list comes in from top and you can see that it slides in underneath the sticky header. That is why the item in the real list needs to be invisible until the sticky header turns invisible. Hope you understand what I mean :P

screenshot_1534752454

bgogetap commented 6 years ago

Yes that makes sense.

I'll put some thought into this. Thanks for the suggestion!