当前位置:   article > 正文

zxing 自动放大,扫描时自动更改屏幕方向(使用ZXING库)

failed to transform zxing-android-embedded-3.6.0.aar (com.journeyapps:zxing-

I've MainActivity.kt where I show different fragments for different needs. At some point, I press button 'X' that calls startScanner() function:

private fun startScanner() {

IntentIntegrator(this)

.setOrientationLocked(false)

.setPrompt("SCANNING?")

.initiateScan()

}

Manifest.xml:

android:name=".MainActiity"

android:theme="@style/AppTheme"

tools:replace="android:screenOrientation"

android:stateNotNeeded="true"

android:screenOrientation="fullSensor"

android:windowSoftInputMode="stateHidden" />

Gradle.file:

compile 'com.journeyapps:zxing-android-embedded:3.6.0'

It does open scanner and everything, but in landscape mode.

Why is this not working?

解决方案

There is a shortcut to do this. Just add this to the manifest:

android:name="com.journeyapps.barcodescanner.CaptureActivity"

android:screenOrientation="portrait"

tools:replace="android:screenOrientation"

android:stateNotNeeded="true"/>

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小惠珠哦/article/detail/931369
推荐阅读
相关标签
  

闽ICP备14008679号