【问题标题】:Is there any way to "smooth scroll" a RecyclerView in a predetermined time?有没有办法在预定时间内“平滑滚动” RecyclerView?
【发布时间】:2019-07-24 14:40:10
【问题描述】:

我想知道是否有任何本地方式可以在预定时间内“平滑滚动”RecyclerView

为了举例说明我的问题,我希望垂直 RecyclerView 高度为 10000dp,从底部滚动到顶部的时间与从中间 (5000dp) 滚动到顶部的时间相同。

如果可以使用插值器,那就太棒了:)


我找不到类似.scrollTo(pos: Int, interpolator: Interpolator, duration: Long)的东西

【问题讨论】:

    标签: android android-recyclerview scroll smooth-scrolling


    【解决方案1】:

    我想你可以找到答案here。基本上你应该重写LinearSmoothScroller 行为并在calculateSpeedPerPixel 方法中实现你自己的逻辑(名字不言自明)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-01-16
      • 1970-01-01
      • 2014-10-30
      • 1970-01-01
      • 2017-03-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多