如果LayoutManager用的是LinearLayoutManager,强烈推荐下面的方法获取滑动距离
private int getScollYDistance() { LinearLayoutManager layoutManager = (LinearLayoutManager) mRecylerview.getLayoutManager(); int position = layoutManager.findFirstVisibleItemPosition(); View firstVisiableChildView = layoutManager.findViewByPosition(position); int itemHeight = firstVisiableChildView.getHeight(); return (position) * itemHeight - firstVisiableChildView.getTop(); }