Android--Zxing库的使用
16lz
2021-01-25
Zxing是一个很成熟的Android 各种码识别框架了,它可以通过摄像头识别二维码,条形码等,在这里用来识别二维码。
官方项目地址:https://github.com/zxing/zxing
可用的demo:https://download.csdn.net/download/yuzhiqiang_1993/9652471#comment
概述
一、框架结构
- android
- BeepManager
- CaptureActivity
- CaptureActivityHandler
- FinishListener
- InactivityTimer
- Intents
- IntentSource
- PreferencesActivity
- camera
- AutoFocusManager
- CameraConfigurationManager
- CameraConfigurationUtils
- CameraManager
- OpenCameraInterface
- PreviewCallback
- decode
- DecodeFormatManager
- DecodeHandler
- DecodeThread
- encode
- CodeCreator
- view
- ViewfiinderResultPointCallback
- ViewfinderView
二、优化
1.框架默认支持所有的码类型,有17种,在枚举类BarcodeFormat中已经定义,AZTEC,
- CODABAR,
- CODE_39,
- CODE_93,
- CODE_128,
- DATA_MATRIX,
- EAN_8,
- EAN_13,
- ITF,
- MAXICODE,
- PDF_417,
- QR_CODE,
- RSS_14,
- RSS_EXPANDED,
- UPC_A,
- UPC_E,
如果只需要支持扫二维码,可以利用Intent启动Activity的时候在intent中传递一些配置信息:
Intent intent = new Intent(getActivity(), CaptureActivity.class);intent.setAction(Intents.Scan.ACTION);intent.putExtra(Intents.Scan.FORMATS, "QR_CODE"); // 只支持扫描二维码startActivityForResult(intent, REQUEST_CODE);
用intent传递一个参数,QR_CODE,如果不传,则默认会加入所有的类型支持,根据菜单中的设置项。代码在DecodeThread中,
更多相关文章
- 《Beginning Android(安卓)Games》给出基本框架的实现(1)
- Android(安卓)Orm框架(GreenDao)
- Android(安卓)轮播图banner框架的使用
- Android图片异步加载框架Android-Universal-Image-Loader
- Android(安卓)View框架总结(三)View工作原理
- Android(安卓)- GET请求,POST请求,数据提交,编码,HttpClient,async-ht
- android中使用zxing扫描二维码以及条形码
- Android调用OpenCV2.4.10实现二维码区域定位
- Android(安卓)核心分析 之七------Service深入分析