I've been experimenting with the new offerings of the library and I just can't wrap my head around customizing it the way I want.
I am taking as a reference this sample code: https://github.com/chrisbanes/cheesesquare
I have successfully managed to add a static fragment (contains some FrameLayout with recyclerView and additional empty views) as the child of the CoordinatorLayout, which works as expected when scrolling the (ugly) recycler view inside it.
The working gist and the result:
I am only trying to add one extra CardView above my fragment, which should also have the same effect on the toolbar when dragged upwards. I tried adding them both to a LinearLayout inside a NestedScrollView, together with other various combinations, of which none was successful. Whenever I tap on the cardview, they are displaced and never again in their own place. Moreover, dragging the cardview still fades out the toolbar, but nothing else happens.
The non-working gist and the result:
I came across a different issue using
CoordinatorLayout
as the container for my fragments: https://code.google.com/p/android/issues/detail?id=179600It seems
CoordinatorLayout
has a number of issues with this use case. The solution is likely to use aFrameLayout
instead to contain your fragment, then put theCoordinatorLayout
as the top level container of your fragment's UI.