我是Android的新手,正在Gestures上工作。我对如何识别文字有疑问。当用户绘制必须识别并必须打印在屏幕顶部的字母或数字时。我知道它可以通过GestureOverlayView完成,但不知道如何实现。

谁能帮我提供一些示例代码。

最佳答案

您可以使用这两个链接,这将对您有所帮助

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//
                }

10-08 03:34