好幾個ChinaCock的朋友說遇到掃碼時閃退,進一步總結,都是Android 8的機器上才會出現,今天我也遇到。正好有朋友說,按下面這個改配置文件就可以解決:
<!-- 掃描的activity 加進來 --> <activity android:name="com.zbar.lib.CaptureActivity" android:theme="@android:style/Theme.Light.NoTitleBar" android:screenOrientation="portrait" /> <!-- 掃描的activity 加進來 完畢 -->
原來舊版本是這樣的:
<!-- 掃描的activity 加進來 --> <activity android:name="com.zbar.lib.CaptureActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:launchMode="singleInstance" android:configChanges="orientation|keyboardHidden" android:screenOrientation="portrait" android:windowSoftInputMode="stateAlwaysHidden" /> <!-- 掃描的activity 加進來 完畢 -->
測試通過,感謝群友Trigger,開發環境:Delphi 10.3.1
另外,有朋友反應說,使用像冊功能,也會閃退,這個問題,按Delphi 10.3.1拍照遇到的問題處理即可。
后記:
android:theme="@android:style/Theme.Light.NoTitleBar"
上面這行,如果寫成:
android:theme="@android:style/Theme.Translucent.NoTitleBar"
就是造成android 8.0.0的機器閃退。