类似于 微信二维码条码扫描 by zxing

hf

Member
Licensed User
B4X:
  zx.isportrait = True
    zx.displayOrientation = 90     '90 is the default value that was set in the library. It works for most devices
                                  'although for eg the Nexus 5 will show an upside down preview with this setting.
                                  'I guess zx.displayOrientation = 270 will fix it for the Nexus 5 when used in portrait mode.
    zx.useFrontCam = False
    'set the timeoutDuration to a very high value (such as 2000000000) if you dont want it to time out
    '2000000000 = 63 years
    zx.timeoutDuration = 3000
   
    zx.islasteruptodown=True '上下扫描
   
    'change these factors between 0 and 1 to change the size of the viewfinder rectangle
    'the library will limit the minimum size to 240 x 240 pixels and the maximum to (screen width) x (screen height) pixels

    zx.theViewFinderXfactor = 0.7      'portrait
    zx.theViewFinderYfactor = 0.5      'portrait
   
'    zx.theViewFinderXfactor = 0.5      'landscape
'    zx.theViewFinderYfactor = 0.5      'landscape
   
    zx.theFrameColor = Colors.Blue
    zx.theLaserColor = Colors.Yellow
    zx.theMaskColor = Colors.argb(255, 0, 0, 255)
    zx.theResultColor = Colors.Green
    zx.theResultPointColor = Colors.Red
   
    'set the prompt messages
    zx.theTopPromptMessage = "This was done......"
    zx.theTopPromptTextSize = 5%y                            'text size in pixels
    zx.topPromptColor = Colors.Green
    zx.topPromptDistanceFromTop = 1%y                        'pixel distance from top
    zx.textSkewnessTop = 0.0
   
   
    zx.theBottomPromptMessage = "Just for fun......"
    zx.theBottomPromptTextSize = 5%y                         'text size in pixels
    zx.bottomPromptColor = Colors.Green
    zx.bottomPromptDistanceFromBottom = 5%y                  'pixel distance from top
    zx.textSkewnessBottom = 0.0
   
    'add a bitmap - portrait
'    zx.theBitMap = bm
'    zx.theBitmapPosition(40%x,10%y,20%x,20%x)
   
    'add a bitmap - landscape
'    zx.theBitMap = bm
'    zx.theBitmapPosition(5%x,5%x,20%y,20%y)   

    zx.mustBeep = True
    zx.mustVibrate = True
   
    'START OF ADDED 7 NOVEMBER 2015:
'   Specify the bar code formats to scan
'   If not specified then all code formats will be scanned
'   Specify one of the following: PRODUCT_FORMATS, ONE_D_FORMATS, QR_CODE_FORMATS, DATA_MATRIX_FORMATS, AZTEC_FORMATS, PDF_417_FORMATS, TWO_D_FORMATS
'   PRODUCT_FORMATS are the following: UPC A, UPC E, EAN 13, EAN 8, RSS 14
'   ONE_D_FORMATS are all the PRODUCT FORMATS plus the following: CODE 39, CODE 93, CODE 128, ITF
'   TWO_D_FORMATS are the following: QR CODE, DATA MATRIX, AZTEC CODE, PDF 417

    'COMMENT THE BELOW LINE OR USE zx.ScanMode = "" to scan all the 1D and 2D type barcodes that this version of the ZXING library supports
    'zx.ScanMode = zx.FORMATS_TWO_D                
    'END OF ADDED 7 NOVEMBER 2015
   
   
    zx.BeginScan("myzx")
https://www.b4x.com/android/forum/t...other-1d-2d-barcodes.49084/page-6#post-528622
 

Attachments

  • JhsIceZxing1.xml
    13.5 KB · Views: 483
  • JhsIceZxing1.jar
    478.3 KB · Views: 492
  • b4aZxing.zip
    11.9 KB · Views: 465
Top