答案 0 :(得分:2)
如果查看引用(https://developers.google.com/android/reference/com/google/android/gms/vision/text/TextBlock),您将看到在识别的块中,您将拥有一个包含元素列表的行列表。
然后你应该在你的Processor类中得到这样的词:
@Override
public void receiveDetections(Detector.Detections<TextBlock> detections) {
SparseArray<TextBlock> items = detections.getDetectedItems();
for (int i = 0; i < items.size(); ++i) {
TextBlock item = items.valueAt(i);
List<Line> lines = (List<Line>) item.getComponents();
for (Line line : lines) {
List<Element> elements = (List<Element>) line.getComponents();
for (Element element : elements) {
String word = element.getValue();
}
}
}
}