- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已将此插件安装到我的 PhoneGap 项目中:
https://github.com/phonegap/phonegap-plugin-barcodescanner
它就像一个魅力。但是,我希望能够在扫描仪打开时打开一些按钮来导航应用程序。这样一来,当应用程序打开时,扫描仪会立即打开,这样他们就可以立即扫描条形码,然后在某个地方有一个按钮,他们可以在其中进入应用程序。
我试过查看插件 javascript 等,但它只有一个 javascript 文件,如下所示:
cordova.define("phonegap-plugin-barcodescanner.BarcodeScanner", function(require, exports, module) { /**
* cordova is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
*
* Copyright (c) Matt Kane 2010
* Copyright (c) 2011, IBM Corporation
*/
var exec = require("cordova/exec");
/**
* Constructor.
*
* @returns {BarcodeScanner}
*/
function BarcodeScanner() {
/**
* Encoding constants.
*
* @type Object
*/
this.Encode = {
TEXT_TYPE: "TEXT_TYPE",
EMAIL_TYPE: "EMAIL_TYPE",
PHONE_TYPE: "PHONE_TYPE",
SMS_TYPE: "SMS_TYPE"
// CONTACT_TYPE: "CONTACT_TYPE", // TODO: not implemented, requires passing a Bundle class from Javascript to Java
// LOCATION_TYPE: "LOCATION_TYPE" // TODO: not implemented, requires passing a Bundle class from Javascript to Java
};
/**
* Barcode format constants, defined in ZXing library.
*
* @type Object
*/
this.format = {
"all_1D": 61918,
"aztec": 1,
"codabar": 2,
"code_128": 16,
"code_39": 4,
"code_93": 8,
"data_MATRIX": 32,
"ean_13": 128,
"ean_8": 64,
"itf": 256,
"maxicode": 512,
"msi": 131072,
"pdf_417": 1024,
"plessey": 262144,
"qr_CODE": 2048,
"rss_14": 4096,
"rss_EXPANDED": 8192,
"upc_A": 16384,
"upc_E": 32768,
"upc_EAN_EXTENSION": 65536
};
};
/**
* Read code from scanner.
*
* @param {Function} successCallback This function will recieve a result object: {
* text : '12345-mock', // The code that was scanned.
* format : 'FORMAT_NAME', // Code format.
* cancelled : true/false, // Was canceled.
* }
* @param {Function} errorCallback
*/
BarcodeScanner.prototype.scan = function (successCallback, errorCallback, config) {
if(config instanceof Array) {
// do nothing
} else {
if(typeof(config) === 'object') {
config = [ config ];
} else {
config = [];
}
}
if (errorCallback == null) {
errorCallback = function () {
};
}
if (typeof errorCallback != "function") {
console.log("BarcodeScanner.scan failure: failure parameter not a function");
return;
}
if (typeof successCallback != "function") {
console.log("BarcodeScanner.scan failure: success callback parameter must be a function");
return;
}
exec(successCallback, errorCallback, 'BarcodeScanner', 'scan', config);
};
//-------------------------------------------------------------------
BarcodeScanner.prototype.encode = function (type, data, successCallback, errorCallback, options) {
if (errorCallback == null) {
errorCallback = function () {
};
}
if (typeof errorCallback != "function") {
console.log("BarcodeScanner.encode failure: failure parameter not a function");
return;
}
if (typeof successCallback != "function") {
console.log("BarcodeScanner.encode failure: success callback parameter must be a function");
return;
}
exec(successCallback, errorCallback, 'BarcodeScanner', 'encode', [
{"type": type, "data": data, "options": options}
]);
};
var barcodeScanner = new BarcodeScanner();
module.exports = barcodeScanner;
});
最佳答案
适用于 Android 的 Phonegap 条码扫描器插件仅提供 Phonegap 和 ZXing 之间的接口(interface)。项目。它是 Android 的 ZXing 客户端,它定义了在“扫描模式”下显示的用户界面,这是 native 完成的(在 Java 中)而不是 Javascript。
要更改它,您需要编辑 library project由插件使用并在那里更改 native UI 代码。
关于javascript - 如何更改 Phonegaps 条码扫描仪插件的外观,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31681306/
Example image 如何在 Phonegap 中添加像这张图片这样的 float 气泡通知。 最佳答案 没有您正在寻找的“开箱即用”插件。但是,您可以创建自己的插件或简单地使用 phonega
我正在使用 HTML 和 JS、JQuery Mobile 构建一个应用程序,并使用 PhoneGap Build 进行打包。客户想知道是否可以添加打印功能...有人知道吗?没有 PG Build 打
我已经安装了 Phonegap 使用 $ npm install -g PhoneGap 我也创建了项目。之后我做了 $ PhoneGap build android 它给出了 [phonegap]
我尝试创建 Phonegap 项目,其中需要集成 ASIHTTPRequest 和 JASON 引用, 并出现以下错误 ld: duplicate symbol _SBJSONErrorDomain
我有一个 Phonegap 应用程序,我从早期版本的 Phonegap 开始,我想升级到最新版本。我需要采取哪些步骤来升级它? 我正在寻求一般性答案,但我的具体情况是 Phonegap 1.1.0 -
我已在我的 MAC 电脑(IOS 10.5.8,SDK 3.1.2)上成功安装 PhoneGap。尝试创建一个新的基于 PhoneGap 的应用程序,包含 PhoneGap 框架并将所需的文件复制到
我正在 phonegap 中为三个不同的平台构建一个应用程序:Android、iOS 和 Blackberry。这样做时,我必须检测设备类型,以便我可以在不同平台和不同设备(如 Android Pho
开始在Mac上使用phonegap(Xcode 4,构建iPhone应用程序)我已经阅读了很多有关名为phonegap.plist的文件的内容,包括外部URL的白名单和其他内容。 这是我的问题,我在
所以我有一个运行 Phonegap 1.4.0 的应用程序(不要问),我决定升级到 1.8.1,这样做时 Phonegap 全局变量不再存在,将被替换为实用程序。 所以我转换了每一次出现: var t
我尝试了什么: 我正在开发一个安卓应用程序。在我的应用程序中,我必须打开 -> 向用户显示 Microsoft Office 文档(doc、docx、xls、xlsx、ppt、pptx)内容。为此,我
使用phonegap制作iOS应用时,ChildBrowser插件可以打开一个可以使用phonegap功能的远程页面吗? 例如:在phonegap应用程序中的index.html,调用childbro
我有一个带有 angularjs 的网络应用程序。我想使用 phonegap 将它变成一个移动应用程序 (android)。 我使用了 phonegap 构建:https://build.phoneg
我正在使用 Phonegap build 为每个平台生成可执行文件。每次更改代码时,我都必须在 phonegap build 上上传代码并生成新的 Apk 文件(适用于 android)。我不想在真实
我很生气,这是毫无疑问的,除了明显的可见差异之外,有人报告高度为: $('body').outerHeight(); //1780 与在我的本地 Windows 8 机器上使用 phonegap
我最近使用 phonegap 完成了我的第一个混合应用程序项目。当谈到公开测试时,我有点害怕签名过程。我从这里以及网上的其他地方阅读了许多不同的建议 fragment 来完成这项工作。 以下是如何为
我是 phonegap 的新手,我尝试创建一个简单的 phonegap 应用程序。 使用命令行安装phonegap后:--- 我已经成功创建了项目,但是当我尝试运行 phonegap build io
我正在为 Android 平台制作一个 phonegap 应用程序。在这个应用程序中,我想在多个 html 页面中滑动导航。请告诉我该怎么做。要么在单个 html 页面中完成,要么我必须为此滑动导航创
是否有任何插件可用于 Juce我可以添加哪些库可以同时适用于 IOS 和 android?如果没有,我如何集成 Juce我的电话间隙应用程序中的库? 最佳答案 没有插件。但您可以使用介绍榨汁机来创建不
Phonegap 刚刚推出了一种方法,可以使用以下命令使用本地服务器立即查看您对 phonegap 应用程序的更改: phonegap serve 然后通过下载 PhoneGap Developer
我们对如何集成phonegap插件,然后使用phonegap build构建我们的移动应用程序有一些疑问,这可能吗? 当您使用 Phonegapbuild 构建您的应用程序时,它会为所有受支持的设备构
我是一名优秀的程序员,十分优秀!