title: Vertically center selected item in RecyclerView
body: <p>I'm trying to implement some kind of wheel picker for my app, because the current options rely on custom <code>Views</code> or the old <code>ListView</code>, so I'd like to base my solution on <code>RecyclerView</code>. </p>
  
  <p>What I did until now was to set at the beginning and at the end of the <code>RecyclerView</code> two <code>View</code> with a different type, named <code>PADDING_TYPE</code> so that the first and the last item are vertically centered in the <code>RecyclerView</code>. </p>
  
  <pre><code>recyclerView.post(new Runnable() {
      @Override
      public void run() {
          //80dp is the height of a regular list item
          int paddingHeight = ((recyclerView.getHeight()-SettingsManager.dptopixels(80))/2);
          binding.getRoot().getLayoutParams().height = paddingHeight;
      }
  });
  </code></pre>
  
  <p>Now I'm trying to understand how to keep the selected item vertically centered.</p>
  
  <p>What I tried so far: </p>
  
  <p><strong>1- LinearSnapHelper</strong></p>
  
  <pre><code>LinearSnapHelper helper = new LinearSnapHelper();
  helper.attachToRecyclerView(mRecyclerView);
  </code></pre>
  
  <p>Does not work as expected, I also tried to Override several methods (probably in a wrong way), but I can't make it automatically vertically center the selection. And it's not snappy enough, the selected item "moves" instead of being locked to vertical center.</p>
  
  <p><strong>2- Custom <code>RecyclerView.OnScrollListener</code></strong></p>
  
  <p>I tried to adapt the code proposed <a href="https://stackoverflow.com/a/38411582/1196752">here</a>, which is for horizontal scrolling, by changing in the <code>RecyclerView.OnScrollListener</code> this line</p>
  
  <pre><code>allPixelsDate += dx;
  </code></pre>
  
  <p>with the vertical scrolling difference:</p>
  
  <pre><code>allPixelsDate += dy;
  </code></pre>
  
  <p>This implementation is close to be working, because it selects the closest item to the vertical center of the list, but without locking it to the center. </p>
  
  <p>Would it be possible to achieve such result? How?</p>
  
  <p>To be more clear: I'd like to achieve the result shown <a href="https://www.youtube.com/watch?v=rercnPOELvs" rel="nofollow noreferrer">here</a> at 1:10. The selection is "locked" at center. </p>