title: Hiding Toolbar smoothly on RecyclerView Scroll?
body: <p>Currently I've a <code>RecyclerView</code> that holds some list of items. I'm listening the <code>Scroll listener</code> of RecyclerView and if the RecyclerView at some point say 500, it should hide the toolbar and it should remain hide when it crosses to 500+. Similarly, it shows the toolbar when i reaches &lt;= 450.</p>
  
  <p>This is the code I've tried so far. The problem is,</p>
  
  <ol>
  <li>It hides the toolbar but it flashes when it hides or shows at that mentioned point.</li>
  <li><p>How to achieve a smooth toolbar hide?</p>
  
  <pre><code>recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
          @Override
          public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
              super.onScrollStateChanged(recyclerView, newState);
  
  
          }
  
  
          @Override
          public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
              super.onScrolled(recyclerView, dx, dy);
  
              scrollD = scrollD + dy;
              Log.d("key", "DY is .." + (dy + scrollD));
  
              if (scrollD &gt;= 500) {
                // code to hide
              }
  
              if (scrollD &lt;= 450) {
  
  
               // code to show
  
              }
          }
      });
  </code></pre></li>
  </ol>