zxing 二维码消耗内存太大,项目容易崩溃,怎么解决
1个回答
2014-10-21 · 知道合伙人软件行家
关注
展开全部
zxing不会吧,你把扫描框调整一下,不要这么大
这个就是设置扫描框的常量
getFramingRect 方法建议你改一下
/**
* Calculates the framing rect which the UI should draw to show the user where to place the
* barcode. This target helps with alignment as well as forces the user to hold the device
* far enough away to ensure the image will be in focus.
*
* @return The rectangle to draw on screen in window coordinates.
*/
public Rect getFramingRect() {
Point screenResolution = configManager.getScreenResolution();
if (framingRect == null) {
if (camera == null) {
return null;
}
int width = (int) (screenResolution.x * 4 / 5);
if (width < MIN_FRAME_WIDTH) {
width = MIN_FRAME_WIDTH;
}
int height = (int) (screenResolution.y / 1.5);
int leftOffset = (screenResolution.x - width) / 2;
int topOffset = (screenResolution.y - height) / 2;
framingRect = new Rect(leftOffset, topOffset, width + leftOffset, width + leftOffset);
Log.d(TAG, "Calculated framing rect: " + framingRect);
}
return framingRect;
}
这是我的zxing扫描源码
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询