GithubHelp home page GithubHelp logo

yisan / zxinglite Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jenly1314/zxinglite

0.0 1.0 0.0 26.61 MB

🔥 ZXing的精简版,优化扫码和生成二维码/条形码功能,一行代码即可使用扫码功能,ZXingLite让集成更简单。(扫码识别速度快如微信)

License: Apache License 2.0

Java 100.00%

zxinglite's Introduction

ZXingLite

Image

Download CI API License Blog

ZXingLite for Android 是ZXing的精简版,基于ZXing库优化扫码和生成二维码/条形码功能,扫码界面完全支持自定义,也可一行代码使用默认实现的扫码功能。总之你想要的都在这里。

简单如斯,你不试试? Come on~

Gif 展示

Image

ViewfinderView属性说明

属性 值类型 默认值 说明
maskColor color #60000000 扫描区外遮罩的颜色
frameColor color #7F1FB3E2 扫描区边框的颜色
cornerColor color #FF1FB3E2 扫描区边角的颜色
laserColor color #FF1FB3E2 扫描区激光线的颜色
resultPointColor color #C0EFBD21 扫描区结果点的颜色
labelText string 扫描提示文本信息
labelTextColor color #FFC0C0C0 提示文本字体颜色
labelTextSize dimension 14sp 提示文本字体大小
labelTextPadding dimension 24dp 提示文本距离扫描区的间距
showResultPoint boolean false 是否显示合适的扫码结果点
frameWidth dimension 扫码框宽度,需与frameHeight同时使用才有效
frameHeight dimension 扫码框高度,需与frameWidth同时使用才有效

引入

Maven:

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

Gradle:

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

Lvy:

<dependency org='com.king.zxing' name='zxing-lite' rev='1.0.5'>
  <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.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>

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

    //跳转的默认扫码界面
    startActivityForResult(new Intent(context,CaptureActivity.class),requestCode);

    //生成二维码
    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

zxinglite's People

Watchers

Bingo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.