If you want to scroll your recyclerview automatically, you can use the below code. Just add this code after setting your recyclerview adapter
Timer timerx;
//first add this global field in your class
//This is the code for auto scroll
try {
Timer timer = new Timer();
timerx = timer;
final int time = 4000; // it's the delay time for sliding between items in recyclerview
timer.schedule(new TimerTask() {
@Override
public void run() {
try {
if (linearLayoutManager.findLastCompletelyVisibleItemPosition() < (topPlayersAdapter.getItemCount() - 1)) {
linearLayoutManager.smoothScrollToPosition(ToprecyclerView, new RecyclerView.State(), linearLayoutManager.findLastCompletelyVisibleItemPosition() + 1);
} else if (linearLayoutManager.findLastCompletelyVisibleItemPosition() == (topPlayersAdapter.getItemCount() - 1)) {
linearLayoutManager.smoothScrollToPosition(ToprecyclerView, new RecyclerView.State(), 0);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}, 0, time);
} catch (Exception e) {
e.printStackTrace();
}