Android Zxing change orientation to portrait

前端 未结 9 968
青春惊慌失措
青春惊慌失措 2020-12-12 19:29

I\'m trying to rotate Zxing display after reading a few questions and posts about the issue. After following the instructions, the display did rotate, but the rectangle of t

相关标签:
9条回答
  • 2020-12-12 19:58

    As of zxing library:2.2.0 support for orientation change is inherent

    Add/edit the following in manifest:

    <activity
        android:name="com.journeyapps.barcodescanner.CaptureActivity"
        android:screenOrientation="fullSensor"
        tools:replace="screenOrientation" />
    

    Set additional property at call to scanner :

    IntentIntegrator integrator = new IntentIntegrator(this);
    
    //allows portrait/landscape mode
    integrator.setOrientationLocked(false);//"additional property"
    integrator.initiateScan();
    

    Reference link : https://github.com/journeyapps/zxing-android-embedded#changing-the-orientation

    0 讨论(0)
  • 2020-12-12 19:58

    try this : add android:screenOrientation="sensorPortrait"

    <activity android:name=".CaptureActivity"
                  android:screenOrientation="sensorPortrait"
                  android:clearTaskOnLaunch="true"
                  android:stateNotNeeded="true"
                  android:theme="@style/CaptureTheme"
                  android:windowSoftInputMode="stateAlwaysHidden"
    
    0 讨论(0)
  • 2020-12-12 20:02

    In your library go to manifest file change the below line under activity tag

    android:screenOrientation="portrait"
    
    0 讨论(0)
提交回复
热议问题