Customize Camera View for Android using zbar

后端 未结 3 1313
孤城傲影
孤城傲影 2021-01-01 00:45

I am new in android development. My app should activate the camera to scan a QR code and decode it to a string. This works fine, but I have one more requirement: to present

3条回答
  •  误落风尘
    2021-01-01 01:00

    I faced the same problem. The solution is simply add the CameraPrevie in your xml inside a frameLayout, and just after that the image you want to put on top of is.

    eg.:

     
    
        
    
        
    
        
    
    
    

    and populate it from your activity:

    Camera mCamera = getCameraInstance();
    
    ImageScanner scanner = new ImageScanner();
    scanner.setConfig(0, Config.X_DENSITY, 3);
    scanner.setConfig(0, Config.Y_DENSITY, 3);
    
    CameraPreview mPreview = new CameraPreview(this, mCamera, null, autoFocusCallB);
    FrameLayout preview = (FrameLayout)findViewById(R.id.cameraPreview);
     preview.addView(mPreview);
    

提交回复
热议问题