Perfect solution to Android using zxing scan QR code changed to vertical screen, the back of the preview screen appears stretched, distorted situation

Source: Internet
Author: User

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.cameraUnder the bag CameraConfigurationManager.javaIn 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 screenResolutionFor 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.