ZXingLite for Android is a simplified version of ZXing, optimized scan code and generate TWO-DIMENSIONAL code function, scan code interface support full customization, make integration easier.

Gif show

ViewfinderView property description

attribute Value types The default value instructions
maskColor color # 60000000 Color of the outer mask of the scanning area
frameColor color #7F1FB3E2 The color of the border of the scan area
cornerColor color #FF1FB3E2 The color of the corner of the scanning area
laserColor color #FF1FB3E2 The color of the laser line in the scanning area
resultPointColor color #C0EFBD21 Color of the result points in the scanning area
text string Scan prompt text messages
textColor color #FFC0C0C0 Prompt text font color
textSize dimension 14sp Prompt text font size
textPadding dimension 24dp Indicates the distance between the text and the scan area
textLocation enum top Indicates the location where the text message is displayed

The introduction of

Maven:

< the dependency > < groupId > com. King. Zxing < / groupId > < artifactId > zxing - lite < / artifactId > < version > 1.0.0 < / version > <type>pom</type> </dependency>Copy the code

Gradle:

Implementation 'com. King. Zxing zxing - lite: 1.0.0'Copy the code

Lvy:

<dependency org='com.king.zxing' name='zxing-lite' rev='1.0.0'>
  <artifact name='$AID' ext='pom'></artifact>
</dependency>
Copy the code
Compile: compile: compile: compile: compile: compile: compile: compile: compile: compile: compile: compile: compile: compile: compile: compile: compile: compile: compile: compile: compile: compile: compile: compile: compile
allprojects {
    repositories {
        maven { url 'https://dl.bintray.com/jenly/maven' }
    }
}Copy the code

Introduced libraries:

CompileOnly 'com. Android. Support: appcompat - v7:27.1.1' API 'com.com.google.zxing:core:3.3.3'Copy the code

The sample

Layout example (customizable layout, at least SurfaceView and ViewfinderView must be included in the layout, and the control ID can be customized according to the getPreviewViewId and getViewFinderViewId methods that override CaptureActivity)

    <merge xmlns:android="http://schemas.android.com/apk/res/android">
        <SurfaceView
            android:id="@+id/preview_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>
        <com.king.zxing.ViewfinderView
            android:id="@+id/viewfinder_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>
    </merge>Copy the code

Code Example (QR code/bar code)

CodeUtils. CreateQRCode (content,600,logo); Codeutils. createBarCode(content, barcodeformat.code_128,800,200);Copy the code

For more details, please see the source code usage examples in app

About me

Name: Jenly

Email: jenly1314#gmail.com / jenly1314#vip.qq.com

CSDN: jenly121

Github: jenly1314

Wechat Official Account:

Join QQ group: 20867961