RecyclerView setSelected和scrolling?

时间:2015-07-21 02:06:04

标签: android android-recyclerview

ListView中,getListView().setSelection(n);用于直接滚动,getListView().smoothScrollToPosition(n);用于平滑滚动。

这可能在RecyclerView吗?

1 个答案:

答案 0 :(得分:3)

您必须使用scrollToPositionWithOffset

//Scroll item 2 to 20 pixels from the top
linearLayoutManager.scrollToPositionWithOffset(2, 20);

这个问题是answered before