RecyclerView:转到不滚动到的位置 [英] RecyclerView: Go to a position not scroll to

查看:29
本文介绍了RecyclerView:转到不滚动到的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

RecyclerView 有没有办法直接转到指定位置而不是滚动到它.(如果到目标的距离很大并且项目布局复杂,滚动可能需要可接受的时间.)

Is there a way with the RecyclerView to go directly to a nominated position rather than scroll to it. (If the distance to the target is large and the item layout complex, scrolling can take an acceptable amount of time.)

推荐答案

使用 ScrollToPosition 直接跳转到 RecyclerView

recyclerView.scrollToPosition(your_position)

http://developer.android.com/reference/android/support/v7/widget/RecyclerView.html#scrollToPosition(int)

这篇关于RecyclerView:转到不滚动到的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆