2013-01-10 28 views
0

我按照這個tutorial配置我的項目使用cordova(也稱爲phonegap)2.3.0。如何在android中使用phonegap在webView中實現條碼掃描器?

如果我通過使用CordovaWebView從我的服務器加載網頁(我不確定是否可以簡單地使用WebView)。

該webView包含一個名爲「條碼掃描儀」的按鈕。我怎樣才能實現條碼掃描器插件,這將允許網頁使用我的設備上的相機掃描條碼?有教程嗎?

webView xml如下所示。

<org.apache.cordova.CordovaWebView xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
style="?android:attr/textAppearanceLarge" 
android:id="@+id/detailitem_detail" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:padding="16dp" 
tools:context=".DetailFragment" /> 
+0

退房此鏈接:http://stackoverflow.com/questions/8311380/phonegap-barcode-scanner –

回答

1

link顯示究竟是如何做到這事。而且這也很容易。

PhoneGap必須實現對所有主要平臺

+0

如果我得到了錯誤「未捕獲的ReferenceError:科爾多瓦未在h-ttp處定義:// the_web_page_from_server:8080/approot/phonegap/barcodescanner.js:47「? –

+0

您是否將phonegap.js添加到了您的HTML文件中? –