Giter VIP home page Giter VIP logo

zxinglite's Introduction

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

zxinglite's People

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.