Scrolling to specific element in Android Kotlin

Viewed 94

So I have a recycler view that has a replies object and I am passing in the id of the object I want to scroll to. How do I get the position of a recyclerview of a passed in id to scroll down using

scrollToPosition(//position)
1 Answers

I assume that you use RecyclerView.Adapter as well. So all you need to do to scroll to concrete item is to get its position from adapter - based on for instance some model id. Result of such query would be position which you need to pass to mentioned method.

Related