1、在build.gradle 中添加zxing依赖。
implementation 'com.journeyapps:zxing-android-embedded:3.5.0'
implementation 'com.google.zxing:core:3.3.3'
2、创建扫码xml文件
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".sy.Sy_ScanQRCodeActivity">
<com.journeyapps.barcodescanner.CompoundBarcodeView
android:id="@+id/barcode_scanner"
android:layout_height="match_parent"
android:layout_width="match_parent"/>

最低0.47元/天 解锁文章
527

被折叠的 条评论
为什么被折叠?



