How to increase scanning area size in zxing

Viewed 16341

Hii everyone currently iam working on scanning qr code from my app and i have used zxing library and it's working good and my problem is in my galaxy s4 mobile the scanning area is very small enter image description here

Please help me

thanks in advance

5 Answers

The CameraManager class has two constants defined MIN_FRAME_WIDTH and MIN_FRAME_HEIGHT. You should modify them as desired and everything should work:

private static final int MIN_FRAME_WIDTH = 240;  // (your desired value here)
private static final int MIN_FRAME_HEIGHT = 240; // (your desired value here)

If you are using ZxingScannerView, you can override createViewFinderView() and increase or decrease the framing rectangle size via viewFinderView like this :

scannerView = object : ZXingScannerView(requireContext()) {
    override fun createViewFinderView(context: Context?): IViewFinder {
         val viewfinderView = super.createViewFinderView(context)
         viewfinderView.setViewFinderOffset(-90) // increase size of framing rectangle
         return viewfinderView;
       }
    }
yourLayour.addView(scannerView)
scannerView.startCamera()
Related