Thanks to this topic, we finally found a way to solve this problem by posting the code below for the redefined LinearLayoutManager, sorry for its kotlin :(, you can also read about it in more detail here
class LinearLayoutManagerWithAccurateOffset(context: Context?) : LinearLayoutManager(context) { // map of child adapter position to its height. private val childSizesMap = mutableMapOf<Int, Int>() override fun onLayoutCompleted(state: RecyclerView.State?) { super.onLayoutCompleted(state) for (i in 0 until childCount) { val child = getChildAt(i) childSizesMap[getPosition(child)] = child.height } } override fun computeVerticalScrollOffset(state: RecyclerView.State?): Int { if (childCount == 0) { return 0 } val firstChildPosition = findFirstVisibleItemPosition() val firstChild = findViewByPosition(firstChildPosition) var scrolledY: Int = -firstChild.y.toInt() for (i in 0 until firstChildPosition) { scrolledY += childSizesMap[i] ?: 0 } return scrolledY } }
source share