RecyclerView inside NestedScrollView does not give correct visible item position
问题 I have a RecyclerView inside a NestedScrollView and I'm trying to get the position of the last visible list item during scroll events using. The following code allows me to reliably detect scroll events: val recyclerView = nestedScrollView.getChildAt(0) as RecyclerView nestedScrollView.setOnScrollChangeListener { v: NestedScrollView?, scrollX: Int, scrollY: Int, oldScrollX: Int, oldScrollY: Int -> val layoutManager = recyclerView?.layoutManager as? LinearLayoutManager val lastVisiblePosition