perfect solution to solve Android using zxing scan QR code changed to vertical screen, after the preview screen appeared stretched, distorted situation
First step: Find
com.zxing.camera
Under the bag
CameraConfigurationManager.java
In the file
void initFromCameraParameters(Camera camera)
Method
Step two: In
Log.d(TAG, "Screen resolution: " + screenResolution);
Then add the following code
new Point();screenResolutionForCamera.x = screenResolution.x;screenResolutionForCamera.y = screenResolution.y;// preview size is always something like 480*320, other 320*480if (screenResolution.x < screenResolution.y) { screenResolutionForCamera.x = screenResolution.y; screenResolutionForCamera.y = screenResolution.x;}
Step Three: Replace
screenResolution
For
screenResolutionForCamera
cameraResolution = getCameraResolution(parameters, screenResolution);
Find the code above and replace it with the code below (e.g.)
cameraResolution = getCameraResolution(parameters, screenResolutionForCamera);
Interested children's shoes can follow my blog, my column will continue to update the Android Studio authoritative tutorial, as well as I/O assembly on the NDK configuration and compilation, I will also share to everyone.
And I received an invitation from CSND's instructor, and later I'll record the use of these Android studio videos.
/** * -------------- * 欢迎转载 | 转载请注明 * -------------- * 如果对你有帮助,请点击|顶| * -------------- * 请保持谦逊 | 你会走的更远 * -------------- * @author zsl * @github https://github.com/yy1300326388 * @blog http://blog.csdn.net/yy1300326388 */
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Perfect solution to Android using zxing scan QR code changed to vertical screen, the back of the preview screen appears stretched, distorted situation