让zxing以纵向模式运行

Joã*_*vas 3 android zxing

我试图在我的应用程序中使用zxing获取qrcode阅读器,而无需安装其他应用程序.但不能让它以肖像显示.

我已经在堆栈溢出和其他网站的负载中读过这个,但问题仍然存在于我的案例中.

基本上每个人都说这是解决方案:

https://gist.github.com/border/7577978

但我唯一得到的是活动仍处于风景中但是,矩形现在更小(带有纵向尺寸)并且相机变得怪异,因为当我向左和向上移动手机时图像旋转90度并向下移动正确地移动手机时.

有人说你需要删除支票:

    if    (width > height) {
  Log.i(TAG, "Display reports portrait orientation; assuming this is incorrect");
  int temp = width;
  width = height;
  height = temp;
}
Run Code Online (Sandbox Code Playgroud)

在CameraConfigurationManager.java中,但该检查不再存在:

CameraConfigurationManager.java

Sun*_*nil 5

试试这个

如果您正在使用此库(编译'com.journeyapps:zxing-android-embedded:3.5.0')来获取QR代码,请将此行添加到您的清单文件中.

  <activity
        android:name="com.journeyapps.barcodescanner.CaptureActivity"
        android:screenOrientation="portrait"
        tools:replace="screenOrientation" />
Run Code Online (Sandbox Code Playgroud)