【发布时间】:2013-04-13 10:05:37
【问题描述】:
我正在通过Android的手势进行手写字母检测的示例工作。当我一次输入一个字符时效果很好。这意味着当我通过手势在屏幕上写 A 时,程序可以很好地识别它(就像我之前将它放在手势库中一样)。到目前为止,我的代码是这样的。
public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) {
ArrayList<Prediction> predictions = gLib.recognize(gesture);
if (predictions.size() > 0 && predictions.get(0).score > 1.0) {
String letter = predictions.get(0).name;
Toast.makeText(this, letter, Toast.LENGTH_SHORT).show();
if(letter.contains("A")) //when matches i print it to edittext
edittext.setText("A");
.
. //rest of stuff here like previous way
.
}
}
但我的标准不是这样。我想认识一个词。我想像as一样一次写一个字。
在为每个成功匹配写一个单词的过程中,相应的字母应该像 as 一样打印在 edittext 上。
A,N,D,R,O,I,D
所以我的问题是如何获得它?是否可以分割手势(在写作时分割单词)?任何工作代码示例或链接将不胜感激。
【问题讨论】:
标签: android gesture-recognition handwriting