ZXing吧code阅读:如何使周围捕获屏幕自定义边框? [英] ZXing Barcode Reader: How to make custom border around capture screen?
问题描述
我希望把自定义的边框围绕zxing捕捉屏幕(相机屏幕)。我需要什么修改,使这个?哪些活动和布局,我需要改变,以有这样的效果吗?
I want to put custom border around zxing capture screen (camera screen). What modification would I need to make for this? Which activity and layouts would I need to change to have this effect?
推荐答案
您并不需要在所有的编辑布局。
You don't need to edit layouts at all.
在 ViewfinderView
找到的OnDraw
方法。这是绘制扫描矩形的核心。你可以修改你想要的方式。
In ViewfinderView
find onDraw
method. It's the core that draws the "scanning rectangle". You can modify it the way you want.
在code,实际上绘制矩形,可以发现<一href="http://$c$c.google.com/p/zxing/source/browse/trunk/android/src/com/google/zxing/client/android/ViewfinderView.java#99">here:
The code that actually draws the rectangle can be found here:
// Draw the exterior (i.e. outside the framing rect) darkened
paint.setColor(resultBitmap != null ? resultColor : maskColor);
canvas.drawRect(0, 0, width, frame.top, paint);
canvas.drawRect(0, frame.top, frame.left, frame.bottom + 1, paint);
canvas.drawRect(frame.right + 1, frame.top, width, frame.bottom + 1, paint);
canvas.drawRect(0, frame.bottom + 1, width, height, paint);
这篇关于ZXing吧code阅读:如何使周围捕获屏幕自定义边框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!