Coding/Android Studio
Zxing QR code Scan 세로모드portrait
떡빵
2018. 11. 17. 23:43
728x90
예전엔 기능 지원을 안했는지 CaptureActivity 상속받아서 커스텀 하는 방법만 있었던거 같은데,
이 글 작성기준 zxing 3.6.0에서는 orientation을 portrait하는 기능을 지원한다.
출처 : https://github.com/journeyapps/zxing-android-embedded#changing-the-orientation 여기에 잘 나와있고,
방법은...
AndroidManifest.xml
<activity android:name="com.journeyapps.barcodescanner.CaptureActivity"
android:screenOrientation="fullSensor"
tools:replace="screenOrientation"/>
해당 zxing 불러오는 Activity
IntentIntegrator integrator = new IntentIntegrator(this); integrator.setOrientationLocked(false); integrator.initiateScan();
가로모드로 불러오는것까지 성공헀다면, 2번째줄만 입력하면 될 것이다.
혹시나 AndroidManifest.xml의 tools에서 Namespace 'tools' is not bound 가 뜬다면....
최상단 <Manifest /> 안에 xmlns:tools="http://schemas.android.com/tools" 을 넣어주자.
728x90