title: Hide and show viewgroup when we scroll up and down the recyclerView
body: <p>I want to hide the view group when we scroll down, and show the view when we scroll up in the <code>recyclerview</code>.</p>
  
  <p>This is my code, in it <code>rvSearchItems</code> is <code>Recyclerview</code>, and <code>rlSearch</code> is the <code>Relative Layout</code> that I want to hide and show:</p>
  
  <pre><code>rvSearchItems.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);
          if (dy &gt;= 0) {
              if (rlSearch.getVisibility() != View.GONE)
                  rlSearch.setVisibility(View.GONE);
          } else if(dy&lt;-5) {
              if (rlSearch.getVisibility() != View.VISIBLE)
                  rlSearch.setVisibility(View.VISIBLE);
          }
      }
  });
  </code></pre>
  
  <p>The main issue here is that it works fine when we're scrolling fast. If we scroll slow it flings multiple times.</p>