View Dosen't resize after call view.setY(float number) and view.setTranslationY(float number) in android
<p>I want to change the size or move during user scroll RecyclerView</p>

<p>There is <code>LinearLayout</code> And <code>RecyclerView</code> in Android</p>

<p>I need to change LinearLayout height size during RecyclerView Scrolled, So
On <code>RecyclerView</code> -> <code>setOnScrollListener</code> -> <code>onScrolled</code> i tried this code :</p>

<pre><code>            if (!defined) {
                toolbarHeight = ll_header.getMeasuredHeight();
                footerHeight = ll_footer.getMeasuredHeight();
                defined = true;
            }
            toolbarOffset += dy;

            if(toolbarOffset &gt; toolbarHeight){
                toolbarOffset = toolbarHeight;
            }
            if(toolbarOffset &lt; 0){
                toolbarOffset = 0;



            }

            ll_header.setY(-1 * toolbarOffset);
            ll_header.requestLayout();

            recycler_view.requestLayout();
</code></pre>

<p><a href="https://i.stack.imgur.com/mtmQP.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mtmQP.jpg" alt="enter image description here"></a></p>