修改ZXing For Android 为竖屏模式,经过实践,可行方法如下:
1、修改AndroidManifest文件,将CaptureActivity设为portrait:
代码为:android:configChanges="orientation|keyboardHidden"
android:screenOrientation="portrait"
2、把摄像头预览景调为竖向,具体如下:
1)在CameraConfigurationManag
er类里的setDesiredCameraParamete
rs(Camera camera)方法里添加如下代
码:
//摄像头旋转90度
setDisplayOrientation (camera, 90);
2)然后在CameraConfigurationManag
er类里面添加setDisplayOrientation(Camera camera, int angle)方法,方法具体代码如下:
protected void setDisplayOrientation
(Camera camera, int angle) {
Method downPolymorphic;
try {
1、修改AndroidManifest文件,将CaptureActivity设为portrait:
2、把摄像头预览景调为竖向,具体如下:
//摄像头旋转90度
setDisplayOrientation (camera, 90);