首页 / 操作系统 / Linux / Zxing图片拉伸解决 Android 二维码扫描
二维码扫描 Android Zxing图片拉伸解决
Zxing是google提供的二维码扫描工程默认是横屏的 转换成竖屏后图片出现拉伸
这里提供解决办法:
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如下:cameraResolution = getCameraResolution(parameters, screenResolutionForCamera);资源下载地址免费下载地址在 http://linux.linuxidc.com/用户名与密码都是www.linuxidc.com具体下载目录在 /2014年资料/5月/2日/Zxing图片拉伸解决 Android 二维码扫描下载方法见 http://www.linuxidc.com/Linux/2013-07/87684.htm更多Android相关信息见Android 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=11本文永久更新链接地址:http://www.linuxidc.com/Linux/2014-05/101114.htm