First you need to create a new OnScrollListener
to be able to detect how much you scrolled your recycler view by using onScrolled
callback method.
and then you need to pass dx and dx int values to your another Recyclerview in order to scroll it simultaneously with your dragged Recyclerview
your new onScrollListener should seems like below
RecyclerView.OnScrollListener scrollListener = new RecyclerView.OnScrollListener {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
scrollAllRecyclerView(recyclerView, dx, dy);
}
private void scrollAllRecyclerView(RecyclerView recyclerView, int dx, int dy) {
scroll(dx, dy)
}
}
private void scroll(int dx, int dy) {
recyclerView.removeOnScrollListener(this);
recyclerView.scrollBy(dx, dy);
recyclerView.addOnScrollListener(this);
}
anotherRecyclerView.scrollBy(dx, dy);