title: recycler view center selected item
body: <p>I'm using RecyclerView for scrolling items horizontally. When any item is clicked , it will be selected and its background changed. What I need is when item is selected, it will scroll to center. First item will be centered at the beginning.</p>
  
  <p>Any comments would be appreciated. My code is below but it doesn't center all items.</p>
  
  <pre><code>recyclerView.addOnItemTouchListener(
              new RecyclerItemClickListener(getActivity(), recyclerView, new RecyclerItemClickListener.OnItemClickListener() {
                  @Override
                  public void onItemClick(View view, final int position) {
                      // TODO Handle item click
                      editAdapter.setSelection(position);
                      editAdapter.notifyDataSetChanged();
                      final int scrollX = (view.getLeft() - (center)) + (view.getWidth() / 2);
                      new Handler().postDelayed(new Runnable() {
                          @Override
                          public void run() {
                              recyclerView.scrollBy(scrollX, 0);
                          }
                      }, 100);
                  }
  
                  @Override
                  public void onLongItemClick(View view, int position) {
  
                  }
              })
      );
  </code></pre>