Android的:最好的方式来处理点,线,圆手势 [英] Android: best way to handle point, line and circular gestures

查看:153
本文介绍了Android的:最好的方式来处理点,线,圆手势的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要处理3种类型的手势在我的应用程序:点,线,圆

I need to handle 3 types of gestures in my app: points, lines and circles.

圈子线向量(可能在不同的方向上绘制的窗口,像8图片密码)。

Circles and lines are vectored (may be drawn in different directions, like in windows 8 picture password).

现在我正在寻找它一个更好的方式 - 阅读 GestureOverlayView ,可是,我怎么知道,这些手势应最初给的,我行会在不同的角度,并且在不同直径的圆。

Now I'm looking for a better way for it - read about GestureOverlayView, but, how I understood, those gestures should be given initially, and my lines will be at different angles, and circles at different diameters.

有没有简单的方法来做到这一点,或者最好使用 onTouchEvent 和数学检测手势?

Is there any easy way to do it, or better to use onTouchEvent and detect gestures mathematically?

推荐答案

当你说需要处理3种类型的手势,究竟你所说的'把手',即意思。你需要什么用手势做?你的意思是,你需要确定一个特定的手势是点,线,圆?

When you said you "need to handle 3 types of gestures", what exactly do you mean by 'handle', ie. what do you need to do with the gestures? Do you mean that you need to determine if a particular gesture is a point, line or circle?

如果您要分析一个姿态,因为它正在绘制或绘制后,你可以创建一个Path对象并在每个onTouchEvent更新。然后,你会做你的数学计算与沿该路径点。 http://developer.android.com/reference/android/graphics/Path.html

If you want to analyse a gesture, as it is being drawn or after it is drawn, you could create a Path object and update it in each onTouchEvent. Then you would do your mathematical calculations with the points along that Path. http://developer.android.com/reference/android/graphics/Path.html

这篇关于Android的:最好的方式来处理点,线,圆手势的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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