Android“滑动"与“逃跑"的对比 [英] Android "swipe" vs "fling"

查看:92
本文介绍了Android“滑动"与“逃跑"的对比的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android开发人员手势设计部分中,术语刷卡"是已使用.
开发者部分中,使用了文件".

In the Android Developers gesture design section, the term "swipe" is used.
In the developer section, the term "fling" is used.

这些术语是同义词吗?从我的发现中,我相信它们是正确的,但是没有一种方法可以明确地说出这一点.

Are these terms synonymous? From what I have found, I believe they are, but nowhere is it explicitly said one way or the other.

也就是说,如果我想实现滑动"功能,是否应该在 GestureDetector 中实现 onFling ?

That said, if I want to implement functionality for a "swipe," should I implement onFling in GestureDetector?

推荐答案

onFling()将在用户进行猛击"运动时执行,并且该运动具有确定运动的速度逃跑的类型是.但是,如果用户只是触摸设备并在屏幕上缓慢移动,则不会被认为是轻击,而是轻扫.

onFling() will get executed when a user makes a "fling" motion, and said motion has a velocity with it to determine the type of fling it was. However, if a user simply touches the device and moves slowly across the screen, that would not be considered a fling, but a swipe.

这取决于您希望用户执行哪种运动.理想的情况是实现 onFling()函数以捕获该运动,并且还实现 onDrag() onDragFinished()来捕获仍应视为滑动的更细微的动作.

It comes down to what type of motion you expect the users to perform. The ideal case would be to implement the onFling() function to capture that motion, and also implement onDrag() and onDragFinished() to capture the more subtle motions that should still be considered a swipe.

这篇关于Android“滑动"与“逃跑"的对比的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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