在ListView
中,getListView().setSelection(n);
用于直接滚动,getListView().smoothScrollToPosition(n);
用于平滑滚动。
这可能在RecyclerView
吗?
答案 0 :(得分:3)
您必须使用scrollToPositionWithOffset。
//Scroll item 2 to 20 pixels from the top
linearLayoutManager.scrollToPositionWithOffset(2, 20);
这个问题是answered before。