java - ZXing条码阅读器: How to make custom border around capture screen?

标签 java android user-interface zxing

我想在 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/

相关文章:

java - org.postgresql.*;类未找到错误

java - 接下来在已经运行的Android ViewPager中插入新的Fragment

C++ GUI 应用程序 : Starting a child process in WndProc ( no MFC )

java gui PaintComponent刷新

android - 如何在 TableLayout 中垂直拉伸(stretch)一行?

user-interface - Kivy - [严重] 绘制椭圆时警告迭代过多

java - 应用程序未在 64 位计算机上运行

java - 使用 java nio 套接字时,“已建立的连接被主机中的软件中止”

java - TestNG:从 eclipse 运行 xml 时重试有效,从命令行运行 xml 时无效

android - LayerList 或 LevelList XML 项中非位图可绘制对象的内联定义