我是Zxing的新手.我在我的Android应用程序中使用zxing进行条形码转换.任何人都可以指导我如何将zxing包含到Android设备中.
我想在我的页面中放一个条形码并可以预览它.条形码生成器是google.zxing,我的报告工具是iReport.
但我不知道,如何配置Image Expression和Expression Class在iReport中的图像.
我正在使用ViewPager在我的片段之间滑动.是否可以在片段内部集成QR扫描仪(zxing或任何其他),以便我可以从扫描仪视图滑动到另一个片段,反之亦然?
据我所知,大多数qr扫描仪要求我使用扩展的Activity类并为结果启动它,在onActivityResult中处理它,这对我来说不是一个选项
我在Android Studio上按照此页面开发了ZXing条形码连续扫描仪.
我的应用build.gradle包括:
repositories {
mavenCentral()
maven {
url "https://raw.github.com/embarkmobile/zxing-android-minimal/mvn-repo/maven-repository/"
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.1'
compile files('src/main/jniLibs/scanditsdk-android-4.7.5.jar')
compile files('src/main/jniLibs/httpclient-4.0.jar')
compile 'com.journeyapps:zxing-android-embedded:3.0.3@aar'
compile 'com.google.zxing:core:3.2.0'
}
Run Code Online (Sandbox Code Playgroud)
我Fragment.xml的布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#00CC00"
android:orientation="vertical"
android:weightSum="100">
<com.journeyapps.barcodescanner.CompoundBarcodeView
android:id="@+id/barcode_scanner"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="40"
>
</com.journeyapps.barcodescanner.CompoundBarcodeView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="100"
style="?android:attr/buttonBarStyle"
>
<Button
android:id="@+id/btnStartScan"
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_weight="25"
android:text="Start"
android:background="@drawable/buttonstyle"
style="@style/button_style"/>
<Button
android:id="@+id/btnStopScan"
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_weight="25"
android:text="Stop"
android:background="@drawable/buttonstyle"
style="@style/button_style"/>
<Button …Run Code Online (Sandbox Code Playgroud) 我已经下载了适用于Android的Zxing条码扫描器代码,但我在源代码中找不到com.google.zxing包.我认为该项目缺少库或JAR文件.任何人都可以帮我找到那个包吗?
这些是未解决的导入:
import com.google.zxing.BarcodeFormat;
import com.google.zxing.Result;
import com.google.zxing.ResultMetadataType;
import com.google.zxing.ResultPoint;
Run Code Online (Sandbox Code Playgroud) 我成功地使用zxing扫描代码,通过调用已安装的条形码阅读器的意图,但是当它发出蜂鸣声并指示良好的扫描时,我希望zxing活动将返回控制,以便我可以处理结果,但它坐在那里并尝试再次扫描.我必须按下后退按钮,然后它返回,我可以执行下一步.当我打电话给扫描仪时,是否有一些明显的标志?
任何建议都感激不尽.非常感谢.
这是我的代码:
public boolean onTouchEvent(final MotionEvent event) {
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("com.google.zxing.client.android.SCAN.SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(intent, 0);
return true;
}
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
if (requestCode == 0) {
if (resultCode == RESULT_OK) {
String contents = intent.getStringExtra("SCAN_RESULT");
String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
// Handle successful scan
String s = "http://www.google.com/search?q=";
s += contents;
Intent myIntent1 = new Intent(Intent.ACTION_VIEW, Uri.parse(s));
startActivity(myIntent1);
}
else
if (resultCode == RESULT_CANCELED) {
// Handle …Run Code Online (Sandbox Code Playgroud) 很多人都注意到了; zxing在最新的xcode中不起作用(4.5/ios 6)
这是用例:
- 从trunk查看最新版本(因为已经添加了一些修复)
- 使用ios 6.0在xcode 4.5中创建单个视图应用程序
- 使用README添加依赖项,路径等(只需按步骤操作)
- 添加zxingcontroller调用类(重命名为mm)
模拟器和设备的编译都失败它显示31错误,如下所示:
Undefined symbols for architecture i386:
"std::string::c_str() const", referenced from
Run Code Online (Sandbox Code Playgroud)
所有31个错误都是相似的,区别在于符号名称
可能有人知道如何用这个用例来解决它?
ps如果你有以前的Xcode的应用程序,它的工作原理.只有在Xcode 4.5中创建新应用程序时才会出现问题
Zxings barscanner app,我已经实现了它,作为一个图书馆项目,它的工作原理.
现在我要改变扫描的字段(目标字段)的大小(也完成).(虽然扫描区域保持不变,但这并不重要,因为焦点仍在中心位置.)
但后来我需要在左侧插入一个菜单.这迫使我改变目标字段,这是它开始崩溃,如果我改变了surfaceview或viewFinderView的大小,如果我将它包装在相对视图中,它仍然只解码中心(原因).我只是无法找到解决方案: - /
简短:我可以更改扫描应该发生的区域,但这只是可见的.实际扫描区域仍然是整个屏幕的中心,而不是移动的可见扫描区域的中心.
谁能帮我?
layout 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**
Run Code Online (Sandbox Code Playgroud)
左图:现在是视图的方式,项目放在无法识别的位置.
右图:放置在识别位置的项目(如何检查目标区域是否未更改):

对CameraManager的更改(挤压取景器):
public Rect getFramingRect() {
// added …Run Code Online (Sandbox Code Playgroud) 使用zxing生成Qr代码的代码是---
它需要字符串数据,imageview这很好用
private void generateQRCode_general(String data, ImageView img)throws WriterException {
com.google.zxing.Writer writer = new QRCodeWriter();
String finaldata = Uri.encode(data, "utf-8");
BitMatrix bm = writer.encode(finaldata, BarcodeFormat.QR_CODE,150, 150);
Bitmap ImageBitmap = Bitmap.createBitmap(150, 150,Config.ARGB_8888);
for (int i = 0; i < 150; i++) {//width
for (int j = 0; j < 150; j++) {//height
ImageBitmap.setPixel(i, j, bm.get(i, j) ? Color.BLACK: Color.WHITE);
}
}
if (ImageBitmap != null) {
qrcode.setImageBitmap(ImageBitmap);
} else {
Toast.makeText(getApplicationContext(), getResources().getString(R.string.userInputError),
Toast.LENGTH_SHORT).show();
}
}
Run Code Online (Sandbox Code Playgroud)
现在我的问题是,如何bar code使用相同的库.我看到一些相关的文件, …
有没有一个工作示例如何从网页上使用zxing条形码扫描仪?
参考此文档:https: //github.com/zxing/zxing/wiki/Scanning-From-Web-Pages
以下测试代码不应该工作吗?
function Test1()
{
$.ajax(
{
url: "zxing://scan/?ret=http%3A%2F%2Ffoo.com%2Fproducts%2F%7BCODE%7D%2Fdescription&SCAN_FORMATS=UPC_A,EAN_13",
success:function()
{
alert("success");
},
error:function()
{
alert("error");
}
});
}
function Test2()
{
$.ajax(
{
url: "http://zxing.appspot.com/scan?ret=http%3A%2F%2Ffoo.com%2Fproducts%2F%7BCODE%7D%2Fdescription&SCAN_FORMATS=UPC_A,EAN_13",
success:function()
{
alert("success");
},
error:function()
{
alert("error");
}
});
}Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<button id="button1" onClick="Test1();">Test 1</button>
<br>
<br>
<button id="button2" onClick="Test2();">Test 2</button>Run Code Online (Sandbox Code Playgroud)
我一直在Android 4.4.2三星Galaxy TabPro和三星Galaxy S4上出现"错误".我已经尝试过股票浏览器,Chrome,Firefox和Dolphin Browser.
即使http://zxing.appspot.com/scan也无法正常工作,因为它总是要求我安装(已安装的)应用程序.
任何帮助将非常感激.