Closed andreborud closed 7 years ago
Thanks, I'm glad you like it!
Wrap your ReyclerView
in a FrameLayout
and that should take care of it.
Since CoordinatorLayout
manages position of AppBar/etc., it is the full height of your screen. CoordinatorLayout
will keep other children under the Toolbar
, like you see with the RecyclerView
, so if the RecyclerView
is wrapped in a FrameLayout
, that FrameLayout
will be used to hold the sticky headers and should position them right where you want them.
I always forget, but you might have to move your "app:layout_behavior="@string/appbar_scrolling_view_behavior"
to the FrameLayout
when you do this. Just in case the scrolling isn't working as you expect, try that.
(edit: The reason it's disappearing is because the CoordinatorLayout
is changing the z
ordering of the Toolbar
. So the Toolbar
is covering the sticky header, which is technically still stickied to the top--that's my theory at least)
That worked perfectly! Thanks! 👍
Nice work! This is so far the best StickyHeaders library I've tried.
Found a little bit of a bug though, or I implemented it wrongly. The first sticky header is shown on top of the toolbar and appbar in my coordinator layout. Then while scrolling the sticky header disappears, but the sticky headers the hide behind the toolbar as can be seen in the gif below. Any ideas?
This is the layout file I'm using:
Putting the recyclerview in its own framlayout makes the stickyheaders work and respect the given space, but the coordinatorlayout scrolling stops to work.