我想在 zxing 捕获屏幕(相机屏幕)周围放置自定义边框。我需要为此做哪些修改?我需要更改哪些 Activity 和布局才能产生这种效果?
最佳答案
您根本不需要编辑布局。
在ViewfinderView
中找到onDraw
方法。它是绘制“扫描矩形”的核心。你可以按照你想要的方式修改它。
可以找到实际绘制矩形的代码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);
关于java - ZXing条码阅读器: How to make custom border around capture screen?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5852059/