ZXing Barcode Reader:如何在捕获屏幕周围制作自定义边框?
我想在 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您根本不需要编辑布局。
在
ViewfinderView
中找到onDraw
方法。它是绘制“扫描矩形”的核心。您可以按照您想要的方式修改它。实际绘制矩形的代码可以在 此处:
You don't need to edit layouts at all.
In
ViewfinderView
findonDraw
method. It's the core that draws the "scanning rectangle". You can modify it the way you want.The code that actually draws the rectangle can be found here:
这个问题已经有答案了。但如果有人需要如何在捕获屏幕周围绘制边框,这里是代码。伊纳扎鲁克的回答是正确的。我的回答只是对此的延伸。
This question already has an answer. But if someone needs how to draw a border around capture screen, here is the code. inazaruk's answer is correct. My answer is just an extension for that.
这里是其他人的做法。
另请参阅此处,它看起来很有用。
最后,我会使用 这个 一个。
Here is how a few others on SO did it.
Also look here, it looked useful.
Finally, I would use this one.
实际上你可以覆盖你自己的colors.xml 文件中的颜色,即
Actually you can override the color in your own colors.xml file i.e.