Zxing 修改 CameraConfigurationManager.java文件的
void initFromCameraParameters(Camera camera)方法,
在 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);
中的screenResolution改为 screenResolutionForCamera
如下: