How to collapse/expand a view based on scroll direction?
<p>I have a View and a RecyclerView housed in a LinearLayout. What I want to achieve is something like this:</p>

<p><a href="https://material.google.com/patterns/scrolling-techniques.html#scrolling-techniques-behavior" rel="nofollow">https://material.google.com/patterns/scrolling-techniques.html#scrolling-techniques-behavior</a></p>

<p>Basically when I scroll the RecyclerView up, the View collapses. It expands if I scroll the RecyclerView down.</p>

<p>I've tried various methods but the animation stutters if the finger jerks around a scroll position. It only animates well if the finger does a deliberate scroll movement in one direction. How do I do this correctly?</p>