简体   繁体   English

如何在Android中以编程方式创建手势?

[英]How to create gesture programmatically in android?

I am a beginner in android.I want to know, how to create gesture programmatically?.That means, i dont need any pre built gesture file created by "gesture builder" app.But i want to create gestures by using only codings not by "gesture builder" app.For example, i want to create an alphapet "A" only by coding.And when the user draw on the gesture overview it want to display the Result "A".Is it possible? 我是android的初学者。我想知道如何以编程方式创建手势?。这意味着,我不需要“手势生成器”应用创建的任何预先构建的手势文件。但是我想仅使用编码而不是通过“手势生成器”应用。例如,我只想通过编码来创建字母“ A”。当用户在手势概述上绘制时,它想显示结果“ A”。是否可以? Can anyone give any idea? 任何人都可以提出任何想法吗?

Android supports the Gesture API since version 1.6. 从1.6版开始,Android就支持Gesture API。 The API can be located in the package android.gesture , and lets you store, load, draw and recognize gestures. 该API可位于包android.gesture ,并允许您存储,加载,绘制和识别手势。 The below tutorial will show you a proof-of-concept application how you can make use of Gesture API. 以下教程将向您展示概念验证应用程序,如何使用Gesture API。

Check out the Create Gesture Programmatically in Android 在Android中以编程方式查看“ 创建手势”

I wrote a blog post about this the other week, here . 前几天,我在这里写了一篇关于这件事的博客文章。

To summarize, you're going to need to look into overriding the onTouchEvent that's provided by every Activity class. 总而言之,您将需要研究覆盖每个Activity类提供的onTouchEvent。

This answer here could also point you in the right direction. 这个答案在这里也可以为你指明正确的方向。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM