QR code scan-improved version of zxing android

Source: Internet
Author: User

After reading vurtex examples, I modified the code based on the [Android instance] QR code scan-Simplified zxing Android source code (Appendix: Chinese supported ).

1. added the method of nesting code into your own project and passing the value (Beginner, if there is a better way to tell me, thank you first)

2. The code scanning interface is processed. (Some existing software is initially implemented. As for the long image, no one will talk about it)

// Draw code with four corners
Paint. setcolor (framecolor); canvas. drawrect (15 + frame. left, 15 + frame. top, 15 + (linewidht + frame. left), 15 + (50 + frame. top), paint); canvas. drawrect (15 + frame. left, 15 + frame. top, 15 + (50 + frame. left), 15 + (linewidht + frame. top), paint); canvas. drawrect (-15 + (0-linewidht) + frame. right), 15 + frames. top,-15 + (1 + frame. right), 15 + (50 + frame. top), paint); canvas. drawrect (-15 + (-50 + frame. right), 15 + frames. top,-15 + frame. right, 15 + (linewidht + frame. top), paint); canvas. drawrect (15 + frame. left,-15 + (-49 + frame. bottom), 15 + (linewidht + frame. left),-15 + (1 + frame. bottom), paint); canvas. drawrect (15 + frame. left,-15 + (0-linewidht) + frame. bottom), 15 + (50 + frame. left),-15 + (1 + frame. bottom), paint); canvas. drawrect (-15 + (0-linewidht) + frame. right),-15 + (-49 + frame. bottom),-15 + (1 + frame. right),-15 + (1 + frame. bottom), paint); canvas. drawrect (-15 + (-50 + frame. right),-15 + (0-linewidht) + frame. bottom),-15 + frame. right,-15 + (linewidht-1) + frame. bottom), paint );

  

 

The linewidht variable controls the width of the four corners and displays the effect when set to 2.

Replace the two sentences defined in the vmiddle hmiddle variable in the viewfinderview class with a small cross coordinate.

canvas.drawRect(hmiddle - 20, vmiddle - 1, hmiddle + 20,vmiddle + 2, paint);canvas.drawRect(hmiddle - 1, vmiddle - 20, hmiddle + 2,vmiddle + 20, paint);

  

Code: http://www.eoeandroid.com/forum.php? MoD = viewthread & tid = 225832 & page = 1 & extra = # pid1997182

Paste some classic scanning Interfaces

References:

Getting started with Android: zxing learning notes

QR code scan-Simplified zxing Android source code (Appendix: Chinese supported)

Full Analysis of Android barcode recognition software development

Zxing to landscape screen recognition to landscape screen Recognition

 

 

 

 

Upload two hours ago

Download Attachment(689.77 KB) scan code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.