我已经使用ZBarSDK来识别 QRCode。我正在尝试将扫描仪覆盖添加到 CameraPreview。在扫描仪覆盖中,我正在尝试为扫描仪添加动画。但是动画很慢。这是我的动画代码:
scanLine.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
Logger.i(CameraOverlay.class, "addOnGlobalLayoutListener");
scanLine.setDrawingCacheEnabled(true);
scanLine.clearAnimation();
scanLine.setAnimation(null);
TranslateAnimation animation = new TranslateAnimation(0, scanRect.width() - 10, 0, 0);
animation.setRepeatCount(-1);
animation.setDuration(2600);
scanLine.startAnimation(animation);
}
});