I have a horizontal RecyclerView
and two button (Next,Previous) as shown in the image below.
so i need to move to the next item or position by use these buttons , i know about method called scrollTo
but i don't know how does it work
I found the answer:
case R.id.next:
mRecyclerView.getLayoutManager().scrollToPosition(linearLayoutManager.findLastVisibleItemPosition() + 1);
break;
case R.id.pre:
mRecyclerView.getLayoutManager().scrollToPosition(linearLayoutManager.findFirstVisibleItemPosition() - 1);
break;