title: Recycler View on Scroll Stop
body: <p>Basically I want my recyclerview to automatically scroll to a position where the item is not half shown. Like the one in googleplay.</p>
  
  <p>I have written a code</p>
  
  <pre><code>public void scrollToVisible(){
      int firstVisibleItemPosition = ((LinearLayoutManager) recyclerView.getLayoutManager()).findFirstVisibleItemPosition();
      View view = recyclerView.getLayoutManager().getChildAt(0);
      if (firstVisibleItemPosition &gt; 0 &amp;&amp; view != null) {
          int offsetTop = view.getTop();
          if (firstVisibleItemPosition - 1 &gt;= 0 &amp;&amp; adapter.getItemCount() &gt; 0) {
              ((LinearLayoutManager) recyclerView.getLayoutManager()).scrollToPositionWithOffset(firstVisibleItemPosition - 1, offsetTop);
          }
      }
  }
  </code></pre>
  
  <p>The problem comes next. I dont know where to put this code. I have a vague idea to put it when the recyclerview stops on scrolling but I've been searching for quite some time now and i cant find such a method. when i put it on the onScroll some unexpected behavior comes out</p>