János János - 3 months ago 7
Android Question

How is it possible get scroll coordinates of a RecycleView?

Want to get scroll coordinates of a

RecycleView
like this:

int scrollX = recycleView.getScrollX();


But it always returns 0, even though view is already scrolled. Why it does not help? How is it possible get the shifted distance of the content?

Answer

Try with this

int scrollX = recycleView.computeHorizontalScrollOffset();