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


    在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;

      }

  • 相关阅读:
    Flutter -- iOS导航栏TabBar
    微信小程序布局
    Tomcat for Mac 搭建本地后台服务器 -- 探索Apache Tomcat
    masnory 动态高度
    iPhone 尺度 x xs sr xsmax
    Deepin 安装 tomcat
    Deepin 设置静态 ip
    md 文件 转 pdf
    mac 上关于截图的偏好设置
    MySQL笔记---DDL
  • 原文地址:https://www.cnblogs.com/rainhome/p/5325665.html
Copyright © 2020-2023  润新知