The RecyclerView.scrollToPosition()
is extremely strange.
for example, supposed a RecyclerView
named \"rv\"
.
if now i
If you want to scroll to a specific position and that position is the adapter's position, then you can use StaggeredGridLayoutManager
scrollToPosition
StaggeredGridLayoutManager staggeredGridLayoutManager = new StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.VERTICAL);
staggeredGridLayoutManager.scrollToPosition(10);
recyclerView.setLayoutManager(staggeredGridLayoutManager);