关于天性码扫描的软件,做软件需求时需要扫描时竖屏:
android提供的SDK(android.hardware.Camera)里大概不能正常的使用竖屏(portrait layout)加载照相机,当用竖屏模式加载照相机时会产生以下情况:1. 照相机成像左倾90度(倾斜);2. 照相机成像长宽比例不对(失比)。
基本上解决办法如下:
1、在AndroidManifest.xml里面配置一下 ,使CaptureActivity属性为portrait: android:screenOrientation="portrait"
2、如果只是单纯的想改变照相机成像的方向,只需要在包com.google.zxing.client.android.camera下的 CameraConfigurationManager类中增加方法
protected void setDisplayOrientation(Camera camera, int angle) {
Method downPolymorphic;
try {
downPolymorphic = camera.getClass().getMethod(
"setDisplayOrientation", new Class[] { int.class });
if (downPolymorphic != null)
downPolymorphic.invoke(camera, new Object[] { angle });
} catch (Exception e1) {