title: How to scroll horizontal recyclerview on click?
body: <p>Actually I want to add a such feature to horizontal <code>recyclerview</code> by which it would be scrolled to next position automatically if it's the last position sometimes it has to go forward and sometimes it has to come backward just like instagram's filter view which is scrolling automatically by the click . I wonder how to perform this task . Currently by my logic it's only scrolling forward but I don't know how to insert logic for backward scroll .</p>
  
  <p>Code:</p>
  
  <pre><code>horzRview.addOnItemTouchListener(new RecyclerItemClickListener(ctx, horzRview, new RecyclerItemClickListener.OnItemClickListener() {
          @Override
          public void onItemClick(View view, int position) {
  
              if(position&lt;adapter.getItemCount()-1)
              horzRview.getLayoutManager().smoothScrollToPosition(horzRview, null, position+1);
  
              else horzRview.getLayoutManager().smoothScrollToPosition(horzRview, null, position-1);
  
          }
  
          @Override
          public void onLongItemClick(View view, int position) {
          }
      }));
  </code></pre>