手势识别在Android中 [英] Gesture Recognition In Android

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

问题描述

我是新的Andr​​oid和我的工作手势。我有一个关于如何识别文本的一个问题。当用户绘制字母或数字,有被认可,具有要被打印在屏幕的顶部。我才知道,它可以通过 GestureOverlayView 进行,但不知道如何实现它。

I'm new to Android and I'm working on Gestures. I have a problem regarding how to recognise the text. When a user draws a letter or number that has to be recognised and has to be printed on the top of the screen. I came to know that it can be done through GestureOverlayViewbut dont know how to implement it.

任何人都可以请帮我带一些样本code。

Can anyone please help me with some sample code.

推荐答案

您可以在这两个环节,这将是有帮助的。

You can these two links which will be helpful

GestureOverlay

GestureOverlayView

使用这种

public class YourClass extends Activity implements OnGesturePerformedListener {  
  private GestureLibrary mLibrary;   
mLibrary = GestureLibraries.fromRawResource(this, R.raw.gestures);  
 if (!mLibrary.load()) {     
    finish();   
  }     
 GestureOverlayView gestures =    (GestureOverlayView)findViewById(R.id.gestures);
     gestures.addOnGesturePerformedListener(this);  
public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) {  
   ArrayList<Prediction> predictions = mLibrary.recognize(gesture); 
    Log.v("performed","performed");  
   // We want at least one prediction  
   if (predictions.size() > 0) {    
     Prediction prediction = predictions.get(0);   
      // We want at least some confidence in the result   
      if (prediction.score > 1.0) {        
                 if(prediction.name.equalsIgnorecase("right")){    
                       //do you thing here//       
                } 

这篇关于手势识别在Android中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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