recyclerview item 吸顶实现的方法

直接上代码RecyclerView.SmoothScroller smoothScroller = new LinearSmoothScroller(context) {
  @Override protected int getVerticalSnapPreference() {
    return LinearSmoothScroller.SNAP_TO_START;    //item 置顶效果
  }
};
smoothScroller.setTargetPosition(position);
layoutManager.startSmoothScroll(smoothScroller);

你可能感兴趣的:(android)