【问题标题】:Android - Remove deceleration of fling in ScrollerAndroid - 移除 Scroller 中的投掷减速
【发布时间】:2014-11-28 12:43:06
【问题描述】:

我在我的代码中使用的这行代码使我很兴奋,但最后速度变慢了。

mScroller.fling(getScrollX(), getScrollY(), velocityX, velocityY, 0, right - width, 0, bottom - height);

那么如何消除滚动条的减速/减速。

PS:我尝试将Interpolator 添加到Scroller,但仍然是同样的问题。

【问题讨论】:

    标签: android scroller onfling


    【解决方案1】:

    您是否尝试过使用 setFriction(0) 或可能使用 LinearInterpolator?

    【讨论】:

    • setFriction 删除了 fling,并针对 API 11+。
    • 感谢您的提示!
    【解决方案2】:

    我最终改用这个,效果很好:

    mScroller.startScroll(getScrollX(), getScrollY(), dx, dy, duration);
    

    【讨论】:

      猜你喜欢
      • 2014-02-19
      • 2022-08-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多