SurfaceView onDraw 模仿减速的用户运动
我实现了一个自定义的 android SurfaceView 类,它绘制(onDraw 方法)通常大于可用设备宽度和高度的东西。当用户触摸屏幕并移动手指时,我需要实现一种图片移动,其速度和方向与用户给出的速度和方向相匹配。这部分我可以在 onTouchEvent 方法中完成。但我的问题是:现在我也希望速度逐渐减速。我认为这可能必须使用 DecelerateInterpolator 进行编码...是否有一些涉及 SurfaceView、onTouchEvent 和 DecelerateInterpolator 的示例或演示...?
I implemented a custom android SurfaceView class which draw (onDraw method) something often bigger than the available device width and height. When the user toutch the screen and move it's finger I need to implement a kind of picture movement with a speed and direction matching the speed and direction given by the user. That part I'm able to do it within onTouchEvent method. But here is my question: now I also want the speed to decelerate progressivly. I think this probably have to be coded with DecelerateInterpolator... Is there some samples or demos somewhere involving a SurfaceView, onTouchEvent and DecelerateInterpolator... ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我正在考虑一个过于复杂的方法来解决这个问题。终于在这里找到了解决我的问题的方法: Smooth rolling in Android OnGestureListener 简化了所有手势管理。
I was thinking of a too complicated way to address the problem. Finally found a way to solve my problem here: Smooth scrolling in Android The OnGestureListener simplify all gestures management.