【发布时间】:2015-10-10 07:49:59
【问题描述】:
在ListView 中,getListView().setSelection(n); 用于直接滚动,getListView().smoothScrollToPosition(n); 用于平滑滚动。
这在RecyclerView 中是否可行?
【问题讨论】:
标签: android android-recyclerview
在ListView 中,getListView().setSelection(n); 用于直接滚动,getListView().smoothScrollToPosition(n); 用于平滑滚动。
这在RecyclerView 中是否可行?
【问题讨论】:
标签: android android-recyclerview
您必须使用scrollToPositionWithOffset。
//Scroll item 2 to 20 pixels from the top
linearLayoutManager.scrollToPositionWithOffset(2, 20);
这个问题是answered before。
【讨论】:
setSelectionFromTop 的等效项时找到了这个答案。