• 修改二维码扫描框的大小位置


    在com.zxing.camera包中找到

    //修改这里最小最大值,限制扫描框大小

     private static final int MIN_FRAME_WIDTH = 240;//240

      private static final int MIN_FRAME_HEIGHT = 240;//240

      private static final int MAX_FRAME_WIDTH = 480;//480

      private static final int MAX_FRAME_HEIGHT = 480;//360

    CameraManager类的getFramingRect方法

    public Rect getFramingRect() {

        Point screenResolution = configManager.getScreenResolution();

        if (framingRect == null) {

          if (camera == null) {

            return null;

          }

          int width = screenResolution.x * 2 / 3;//设定框框宽度大小

          if (width < MIN_FRAME_WIDTH) {

            width = MIN_FRAME_WIDTH;

          } else if (width > MAX_FRAME_WIDTH) {

            width = MAX_FRAME_WIDTH;

          }

          int height = screenResolution.y * 2/ 4;//设定框框高度大小

          if (height < MIN_FRAME_HEIGHT) {

            height = MIN_FRAME_HEIGHT;

          } else if (height > MAX_FRAME_HEIGHT) {

            height = MAX_FRAME_HEIGHT;

          }

          int leftOffset = (screenResolution.x - width) / 2;//设定框框离左边相对位置

          int topOffset = (screenResolution.y - height) / 5;//设定框框离顶部相对位置

          framingRect = new Rect(leftOffset, topOffset, leftOffset + width, topOffset + height);

          Log.d(TAG, "Calculated framing rect: " + framingRect);

        }

        return framingRect;

      }

  • 相关阅读:
    在IDEA上本地更新同步Git中的更改
    protobuf的序列化和反序列化
    关于Pytorch报警告:Warning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead
    990. 等式方程的可满足性
    死锁
    事务隔离
    Lab-1
    软件测试homework3
    TCP/UDP网络连接的固定写法
    软件测试Homework 2
  • 原文地址:https://www.cnblogs.com/rainhome/p/5325665.html
Copyright © 2020-2023  润新知