自定义手势探测器 [英] Custom gesture detector

查看:234
本文介绍了自定义手势探测器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一些海关的姿态,在我的应用程序启用某些特定设置。

I need to create some customs gesture to enable some particular settings on my app.

例如,我需要的照片,以创建像A L手势

For example I need to create a L gesture like in the photo

有一种方法可以节省的手势,然后当执行其中的一个retrive?

There's a way to save gesture and then retrive when one of them are performed?

推荐答案

有安装在仿真器的应用程序称为GestureBuilder,它允许你保存和记录自定义手势。如果你不想在你的模拟器中运行它,你也可以找到它附带的SDK文件,只需将其导入,您的设备上运行。请参见这篇文章以获取更多信息。

There is an app installed on emulators called GestureBuilder, which allows you to save and record custom Gestures. If you don't want to run it in your emulator, you can also find it in the included SDK documents, just import it and run it on your device. See this article for more information.

一旦你保存的姿态文件,那么你需要保存的姿态文件复制到/ RES /原始文件夹中,加载它,并附加一个手势侦听器,如在的这篇文章

Once you have the saved gesture file, then you need to copy the saved gesture file to your /res/raw folder, load it, and attach a gesture listener, as is done in this article:

gestureLibrary = GestureLibraries.fromRawResource(this, R.raw.gestures);
     gestureLibrary.load();
 OnGesturePerformedListener gesturePerformedListener
 = new OnGesturePerformedListener(){

 @Override
 public void onGesturePerformed(GestureOverlayView view, Gesture gesture) {
  // TODO Auto-generated method stub
  ArrayList<Prediction> prediction = gestureLibrary.recognize(gesture);
  if(prediction.size() > 0){
   gestureResult.setText(prediction.get(0).name);
  }

 }};
}

这篇关于自定义手势探测器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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