Android使用Zxing扫描二维码改成竖屏后,后面的预览画面出现了拉伸,扭曲解决方案

更改CameraConfigurationManager.java文件

在 Log.d(TAG, "Screen resolution: " + screenResolution);这句之后增加
Point screenResolutionForCamera = new Point();
        screenResolutionForCamera.x = screenResolution.x;
        screenResolutionForCamera.y = screenResolution.y;
        // preview size is always something like 480*320, other 320*480
        if (screenResolution.x < screenResolution.y) {
        screenResolutionForCamera.x = screenResolution.y;
        screenResolutionForCamera.y = screenResolution.x;
        }
再更改cameraResolution = getCameraResolution(parameters, screenResolution);为cameraResolution = getCameraResolution(parameters, screenResolutionForCamera);

你可能感兴趣的:(Android使用Zxing扫描二维码改成竖屏后,后面的预览画面出现了拉伸,扭曲解决方案)