Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/385.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何修复不正确的条形码扫描?_Java_Android_Android Studio_Barcode_Zxing - Fatal编程技术网

Java 如何修复不正确的条形码扫描?

Java 如何修复不正确的条形码扫描?,java,android,android-studio,barcode,zxing,Java,Android,Android Studio,Barcode,Zxing,我使用“me.dm7.barcodescanner:zxing:1.9”从条形码中获取代码,程序运行良好,但存在一个问题。即使条形码不在矩形中,程序也能工作,此时程序给出的代码与条形码完全不同。当条形码显示在矩形上时,如何使程序工作 ViewGroup contentFrame = (ViewGroup) findViewById(R.id.ScanView); mScannerView = new ZBarScannerView(this); contentFrame.addView(mSc

我使用“me.dm7.barcodescanner:zxing:1.9”从条形码中获取代码,程序运行良好,但存在一个问题。即使条形码不在矩形中,程序也能工作,此时程序给出的代码与条形码完全不同。当条形码显示在矩形上时,如何使程序工作

ViewGroup contentFrame = (ViewGroup) findViewById(R.id.ScanView);
mScannerView = new ZBarScannerView(this);

contentFrame.addView(mScannerView);

barcodeFormatEAN13 = BarcodeFormat.EAN13;
listaZaFormat.add(barcodeFormatEAN13);
mScannerView.setFormats(listaZaFormat);

askForPermission(Manifest.permission.CAMERA, CAMERA);

我建议将取景器设置为与摄影机视图相同的大小,因为整个摄影机视图将查找条形码。在我使用zscanner的软件时,它有时会检测到丢失的条形码。如果将帧缩小,则它可能更易于控制