- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
Zxings barscanner 应用程序,我已经将它实现为一个库项目,并且可以正常工作。
现在我要更改扫描的字段(目标字段)的大小(也已完成)。(尽管扫描区域保持不变,但这并不重要,因为焦点仍在中心。)
但后来我需要在左侧插入一个菜单。这迫使我更改目标字段,这就是它开始崩溃的原因,如果我更改 surfaceview 或 viewFinderView 的大小,并且如果我将它包装在相对 View 中,它仍然只解码中心(原因)。我就是想不出解决办法:-/
短:我可以更改应该进行扫描的区域,但这只是可见的。实际扫描区域仍然是整个屏幕的中心,而不是移动的可见扫描区域的中心。
谁能帮帮我?
布局 XML(插入菜单,删除不必要的菜单):
<SurfaceView
android:id="@+id/preview_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<com.google.zxing.client.android.ViewfinderView
android:layout_marginLeft="120dip"
android:id="@+id/viewfinder_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/transparent" />
<LinearLayout
android:id="@+id/buttonPanel"
android:layout_width="120dip"
android:layout_height="fill_parent"
android:background="#000"
android:orientation="vertical"
android:paddingBottom="15dip"
android:paddingTop="15dip" >
<TextView
android:id="@+id/menuText"
android:layout_weight="1"
android:layout_width="90dip"
android:layout_height="wrap_content"
android:layout_marginLeft="15dip"
android:text="@string/menu_title"/>
<ImageView
android:id="@+id/d1Button"
android:layout_width="90dip"
android:layout_height="wrap_content"
android:layout_marginLeft="15dip"
android:layout_weight="2"
android:onClick="scanner1d"
android:src="@drawable/d1image" />
<ImageView
android:id="@+id/d2Button"
android:layout_width="90dip"
android:layout_height="wrap_content"
android:layout_marginLeft="15dip"
android:layout_weight="2"
android:onClick="scanner2d"
android:src="@drawable/d2image" />
</LinearLayout>
<LinearLayout
android:id="@+id/result_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/result_view"
android:orientation="vertical"
android:padding="4dip"
android:visibility="gone" >
**removed**
</LinearLayout>
**removed**
左图: View 现在的样子,项目放置在未被识别的地方。
右图:Item放置在被识别的地方(我如何检查目标区域没有改变):
CameraManager 的变化(取景器的挤压):
public Rect getFramingRect() {
// added
int menuSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
(float) 120, context.getResources().getDisplayMetrics());
// end of added
Point screenResolution = configManager.getScreenResolution();
if (framingRect == null) {
if (camera == null) {
return null;
}
int width = screenResolution.x * 3 / 4;
if (width < MIN_FRAME_WIDTH) {
width = MIN_FRAME_WIDTH;
} else if (width > MAX_FRAME_WIDTH) {
width = MAX_FRAME_WIDTH;
}
int height = screenResolution.y * 3 / 4;
if (height < MIN_FRAME_HEIGHT) {
height = MIN_FRAME_HEIGHT;
} else if (height > MAX_FRAME_HEIGHT) {
height = MAX_FRAME_HEIGHT;
}
// added menu size for calculation
int leftOffset = ((screenResolution.x -menuSize - width) / 2);
int topOffset = (screenResolution.y - height) / 2;
framingRect = new Rect(leftOffset, topOffset, leftOffset + width,
topOffset + height);
Log.d(TAG, "Calculated framing rect: " + framingRect);
}
return framingRect;
}
现在我把它全部拿出来放到一个可以找到的小项目中 here (问题已解决,缺少一个库)10 月 18 日 10:14 CET
最佳答案
如果您同时挤压表面 View 和取景器 View ,它实际上会起作用。
虽然你必须考虑到图像被挤压,所以目标矩形必须小得多。
关于android - ZXings barcodescanner添加Menu,并挤压surfaceview,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12859066/
我是 Phonegap 和 JS 的新手……我用条形码扫描仪试了一下……我安装了 phonegap 和本教程中的所有内容http://teusink.blogspot.com/2013/07/guid
我正在尝试将 BarcodeScanner 插件与 PhoneGap 一起用于我的网络应用程序。它是适用于 iOS 和 Android 的移动应用程序。在我的服务器上的 web 应用程序中,我有 ht
如标题所述,我想将相机功能存储在单独的容器中。这意味着,如果相机启动,它只显示在红色容器中,此时我该如何实现? 我的屏幕图片:https://imgur.com/a/0qFvHto 我使用以下依赖项进
我正在使用barcodescanner图书馆。 有一个“SimpleScannerActivity”的示例代码: public class SimpleScannerActivity extends
本文整理了Java中me.dm7.barcodescanner.zxing.ZXingScannerView类的一些代码示例,展示了ZXingScannerView类的具体用法。这些代码示例主要来源于
本文整理了Java中me.dm7.barcodescanner.zbar.ZBarScannerView类的一些代码示例,展示了ZBarScannerView类的具体用法。这些代码示例主要来源于Git
我已经为 iOS 安装了最新版本的 Node.js、PhoneGap 和 PhoneGap 开发者应用程序。我的系统是 Windows 8.1(64 位)。测试设备为 iOS 最新版本的 iPhone
我正在使用 MeteorJs 和 Cordova 以及 Barcodescanner 插件。 我需要对不同的二维码进行多次读取,并将每次读取发送到远程服务器。 使用此代码,我可以进行一次读取,然后 C
我想安装 BarcodeScanner plugin在 PhoneGap 项目中。我已阅读存储库中的自述文件,它说它必须与 PlugMan 一起安装,如下所示: Install a plugin --
motorolla symbol barcodescanner 使用委托(delegate)事件函数,如果我试图在该空间的上下文中禁用扫描器,我会得到空引用异常。 如果我简单地禁用扫描仪但在执行该功能
我在使用 Cordova 制作的应用程序上使用此条形码扫描器 ( https://github.com/wildabeast/BarcodeScanner ),专门针对在 Android 设备上使用。
我正在使用 Cordova 开发一个 iOS 应用程序,我从这个 link 下载了 Cordova 条码扫描器插件。 . 但是,它只适用于纵向模式。 我在 CDVBarcodeScanner.mm 中
代码如下: import { Component } from '@angular/core'; import { NavController, Platform } from 'ion
我目前正在尝试在我的 phonegap 项目中实现 barcodescanner。但我完全迷失了,因为我阅读了很多关于 barecodescanner 的主题,并且提供的所有可能的解决方案都不适合我。
我在 ionic BarcodeScanner 库中存在的 ionic 3 中自定义(二维码扫描屏幕)的设计时遇到问题。 我需要帮助自定义此屏幕,添加页眉、页脚和按钮。 在附件中,有设计的屏幕截图和
我正在使用barcodescanner.js来扫描二维码。我已下载 CaptureActivity android 库并将其附加到我的项目中 但是当我调用以下代码时 window.plugins.ba
我希望将 PhoneGap 的 BarcodeScanner 插件与我的应用程序集成,但希望将其与现有的 HTML/JS(WebView 内部)集成得比目前允许的更紧密。 理想情况下,我希望看到 Ba
iOS 工作正常 BarCodeScanner 全屏显示,但当我使用 android 时,会有额外的空白。 我也通过提供不同的风格进行检查,但没有运气 style={{ height: Dime
我正在尝试使用 PointOfService API 读取条形码数据。 我从一个空白的 Windows 应用程序模板开始。添加了一个按钮,单击该按钮我有以下代码 var defaultScanner
我正在尝试让barcodeScanner 在我的phonegap iOS 应用程序上运行。它似乎已正确安装(我使用了plugman),但是当我按照他们的指示对barcodescanner进行javas
我是一名优秀的程序员,十分优秀!