title: Get center visible item of RecycleView when scrolling
body: <p>This is what I want:</p>
  <p><a href="https://i.stack.imgur.com/WiBoA.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/WiBoA.gif" alt="enter image description here" /></a></p>
  <p>As image above, I want to draw a center line on <code>RecycleView</code>, then get the center item when scrolling (as well as move left or right)<br>
  Here is my try to draw a horizontal <code>RecycleView</code>:</p>
  <pre><code>    HorizontalAdapter adapter = new HorizontalAdapter(data);
      LinearLayoutManager layoutManager
              = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
      recycleView.setLayoutManager(layoutManager);
      recycleView.setAdapter(adapter);
  </code></pre>
  <p>Is there any way to know which item is moved to the center of <code>RecycleView</code>? And how can I scroll <code>RecycleView</code> to left or right just one position?</p>
  <p><strong>Update</strong>: I tried to use a scroll listener to get the middle position, but it doesn't work as an aspect.</p>
  <pre><code>  @Override
          public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
              super.onScrolled(recyclerView, dx, dy);
              int firstPos = layoutManager.findFirstVisibleItemPosition();
              int lastPos = layoutManager.findLastVisibleItemPosition();
              int middle = Math.abs(lastPos - firstPos) / 2 + firstPos;
  
              int selectedPos = -1;
              for (int i = 0; i &lt; adapter.getItemCount(); i++) {
                  if (i == middle) {
                      adapter.getItem(i).setSelected(true);
                      selectedPos = i;
                  } else {
                      adapter.getItem(i).setSelected(false);
                  }
              }
  
              adapter.notifyDataSetChanged();
          }
  </code></pre>
  <p>And get the result:</p>
  <p><a href="https://i.stack.imgur.com/UMyek.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/UMyek.gif" alt="enter image description here" /></a></p>
  <p>I only want to change the selected item (make text to white color) when it is on the blue <code>Rect</code></p>