53

GitHub - jenly1314/ZXingLite: ZXing的精简版,优化扫码和生成二维码/条形码功能,让...

 5 years ago
source link: https://github.com/jenly1314/ZXingLite
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

ZXingLite

Image

Download CI API License Blog

ZXingLite for Android 是ZXing的精简版,优化扫码和生成二维码功能,扫码界面支持完全自定义,让集成更简单。

Gif 展示

Image

ViewfinderView属性说明

属性 值类型 默认值 说明 maskColor color #60000000 扫描区外遮罩的颜色 frameColor color #7F1FB3E2 扫描区边框的颜色 cornerColor color #FF1FB3E2 扫描区边角的颜色 laserColor color #FF1FB3E2 扫描区激光线的颜色 resultPointColor color #C0EFBD21 扫描区结果点的颜色 text string

扫描提示文本信息 textColor color #FFC0C0C0 提示文本字体颜色 textSize dimension 14sp 提示文本字体大小 textPadding dimension 24dp 提示文本距离扫描区的间距 textLocation enum top 提示文本信息显示的位置

引入

Maven:

<dependency>
  <groupId>com.king.zxing</groupId>
  <artifactId>zxing-lite</artifactId>
  <version>1.0.0</version>
  <type>pom</type>
</dependency>

Gradle:

implementation 'com.king.zxing:zxing-lite:1.0.0'

Lvy:

<dependency org='com.king.zxing' name='zxing-lite' rev='1.0.0'>
  <artifact name='$AID' ext='pom'></artifact>
</dependency>
如果Gradle出现compile失败的情况,可以在Project的build.gradle里面添加如下:(也可以使用上面的GitPack来complie)
allprojects {
    repositories {
        maven { url 'https://dl.bintray.com/jenly/maven' }
    }
}

引入的库:

compileOnly 'com.android.support:appcompat-v7:27.1.1'
api 'com.com.google.zxing:core:3.3.3'

示例

布局示例 (可自定义布局,布局内至少要保证有SurfaceView和ViewfinderView,控件id可根据重写CaptureActivity 的 getPreviewViewId 和 getViewFinderViewId方法自定义)

    <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>

代码示例 (二维码/条形码)

    //生成二维码
    CodeUtils.createQRCode(content,600,logo);
    //生成条形码
    CodeUtils.createBarCode(content, BarcodeFormat.CODE_128,800,200);

更多使用详情,请查看app中的源码使用示例

关于我

Name: Jenly

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

CSDN: jenly121

Github: jenly1314

微信公众号:

公众号

加入QQ群: 20867961


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK