最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android實(shí)現(xiàn)基于ZXing快速集成二維碼掃描功能

 更新時(shí)間:2017年07月12日 10:15:11   作者:zhangphil  
這篇文章主要為大家詳細(xì)介紹了Android二維碼掃描ZXing快速項(xiàng)目集成的相關(guān)資料,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

二維碼掃描現(xiàn)在是一直比較多的應(yīng)用場(chǎng)景,android的開(kāi)源項(xiàng)目ZXing提供了完整、成熟的解決方案,如果僅僅是出于快速開(kāi)發(fā)的目的,可以根據(jù)自己的項(xiàng)目需要,把ZXing官方提供的項(xiàng)目稍加裁剪,就可以快速的集成到自己的項(xiàng)目中。下面詳細(xì)演示和介紹如何實(shí)現(xiàn)基于ZXing官方提供的源碼,快速集成二維碼掃描功能到自己項(xiàng)目中的解決方案。 

(第1步):到ZXing官方主頁(yè)下載最新的項(xiàng)目代碼包,ZXing在github的官方主頁(yè):https://github.com/zxing,下載后解壓。解壓后根目錄下有若干項(xiàng)目目錄,其中的:android就是我們需要的項(xiàng)目,把它導(dǎo)入到Eclispse中。 

(第2步):ZXing的Android項(xiàng)目需要引用兩個(gè)關(guān)鍵的庫(kù)文件:android-core-x.x.x.jarcore-x.x.x.jar,其中x.x.x表示版本號(hào)。截止發(fā)表本博文時(shí)候,版本已經(jīng)是3.2.0了。這兩個(gè)關(guān)鍵的android-core-x.x.x.jar 和 core-x.x.x.jar 文件,實(shí)際上都可以從第一步下載得到的源代碼中自己編譯生成,網(wǎng)上也有編譯的具體方案,但簡(jiǎn)單期間,也可以從ZXing的官方直接下載已經(jīng)編譯好的文件,其中android-core的下載鏈接是:http://repo1.maven.org/maven2/com/google/zxing/android-core/,另外一個(gè)ZXing的core下載鏈接是:http://repo1.maven.org/maven2/com/google/zxing/core/ ,選擇最新版本的庫(kù)文件或者自己需要的版本號(hào),下載后,和其他android項(xiàng)目中導(dǎo)入庫(kù)文件類似,導(dǎo)入到Android項(xiàng)目中的libs目錄下,如果沒(méi)有l(wèi)ibs,新建一個(gè)名為libs的目錄,把兩個(gè)庫(kù)文件放進(jìn)去即可。 

(第3步):這一步作為演示,我們自己新建一個(gè)MainActiviy,作為項(xiàng)目的啟動(dòng)器Activity,App將啟動(dòng)我們自己的MainActivity。觀察ZXing官方提供的AndroidManifest.xml文件: 

<?xml version="1.0" encoding="UTF-8"?>
<!--
 Copyright (C) 2008 ZXing authors

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
   package="com.google.zxing.client.android"
   android:versionName="4.7.3"
   android:versionCode="103"
   android:installLocation="auto">

 <uses-permission android:name="android.permission.CAMERA"/>
 <uses-permission android:name="android.permission.INTERNET"/>
 <uses-permission android:name="android.permission.VIBRATE"/>
 <uses-permission android:name="android.permission.FLASHLIGHT"/>
 <uses-permission android:name="android.permission.READ_CONTACTS"/>
 <uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS"/>
 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
 <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

 <uses-sdk android:minSdkVersion="15" android:targetSdkVersion="21"/>

 <!-- Don't require camera, as this requires a rear camera. This allows it to work on the Nexus 7 -->
 <uses-feature android:name="android.hardware.camera" android:required="false"/>
 <uses-feature android:name="android.hardware.camera.front" android:required="false"/>
 <!-- TODO replace above two with next line after Android 4.2 -->
 <!-- <uses-feature android:name="android.hardware.camera.any"/> -->
 <uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
 <uses-feature android:name="android.hardware.camera.flash" android:required="false"/>
 <uses-feature android:name="android.hardware.screen.landscape"/>
 <uses-feature android:name="android.hardware.wifi" android:required="false"/>
 <!-- This excludes Google TV, which is unfortunately included by virtue of not requiring a camera -->
 <uses-feature android:name="android.hardware.touchscreen"/>
 <!-- TODO make this not required again after android.hardware.camera.any is available -->

 <supports-screens android:xlargeScreens="true"
     android:largeScreens="true"
     android:normalScreens="true"
     android:smallScreens="true"
     android:anyDensity="true"/>

 <application android:icon="@drawable/launcher_icon"
    android:logo="@drawable/launcher_icon"
    android:label="@string/app_name"
    android:allowBackup="true">
 <activity android:name=".CaptureActivity"
    android:screenOrientation="sensorLandscape"
    android:clearTaskOnLaunch="true"
    android:stateNotNeeded="true"
    android:theme="@style/CaptureTheme"
    android:windowSoftInputMode="stateAlwaysHidden">
  <intent-filter>
  <action android:name="android.intent.action.MAIN"/>
  <category android:name="android.intent.category.LAUNCHER"/>
  </intent-filter>
  <intent-filter>
  <action android:name="com.google.zxing.client.android.SCAN"/>
  <category android:name="android.intent.category.DEFAULT"/>
  </intent-filter>
  <!-- Allow web apps to launch Barcode Scanner by linking to http://zxing.appspot.com/scan. -->
  <intent-filter>
  <action android:name="android.intent.action.VIEW"/>
  <category android:name="android.intent.category.DEFAULT"/>
  <category android:name="android.intent.category.BROWSABLE"/>
  <data android:scheme="http" android:host="zxing.appspot.com" android:path="/scan"/>
  </intent-filter>
  <!-- We also support a Google Product Search URL. -->
  <intent-filter>
  <action android:name="android.intent.action.VIEW"/>
  <category android:name="android.intent.category.DEFAULT"/>
  <category android:name="android.intent.category.BROWSABLE"/>
  <data android:scheme="http" android:host="www.google.com" android:path="/m/products/scan"/>
  </intent-filter>
  <!-- And the UK version. -->
  <intent-filter>
  <action android:name="android.intent.action.VIEW"/>
  <category android:name="android.intent.category.DEFAULT"/>
  <category android:name="android.intent.category.BROWSABLE"/>
  <data android:scheme="http" android:host="www.google.co.uk" android:path="/m/products/scan"/>
  </intent-filter>
  <!-- Support zxing://scan/?... like iPhone app -->
  <intent-filter>
  <action android:name="android.intent.action.VIEW"/>
  <category android:name="android.intent.category.DEFAULT"/>
  <category android:name="android.intent.category.BROWSABLE"/>
  <data android:scheme="zxing" android:host="scan" android:path="/"/>
  </intent-filter>
 </activity>
 <activity android:name=".PreferencesActivity"
    android:label="@string/preferences_name"
    android:stateNotNeeded="true"/>
 <activity android:name=".encode.EncodeActivity"
    android:stateNotNeeded="true">
  <intent-filter>
  <action android:name="com.google.zxing.client.android.ENCODE"/>
  <category android:name="android.intent.category.DEFAULT"/>
  </intent-filter>
  <!-- This allows us to handle the Share button in Contacts. -->
  <intent-filter>
  <action android:name="android.intent.action.SEND"/>
  <category android:name="android.intent.category.DEFAULT"/>
  <data android:mimeType="text/x-vcard"/>
  </intent-filter>
  <!-- This allows us to handle sharing any plain text . -->
  <intent-filter>
  <action android:name="android.intent.action.SEND"/>
  <category android:name="android.intent.category.DEFAULT"/>
  <data android:mimeType="text/plain"/>
  </intent-filter>
 </activity>
 <activity android:name=".book.SearchBookContentsActivity"
    android:label="@string/sbc_name"
    android:stateNotNeeded="true"
    android:screenOrientation="sensorLandscape">
  <intent-filter>
  <action android:name="com.google.zxing.client.android.SEARCH_BOOK_CONTENTS"/>
  <category android:name="android.intent.category.DEFAULT"/>
  </intent-filter>
 </activity>
 <activity android:name=".share.ShareActivity"
    android:stateNotNeeded="true"
    android:screenOrientation="user">
  <intent-filter>
  <action android:name="com.google.zxing.client.android.SHARE"/>
  <category android:name="android.intent.category.DEFAULT"/>
  </intent-filter>
 </activity>
 <activity android:name=".history.HistoryActivity"
    android:label="@string/history_title"
    android:stateNotNeeded="true"/>
 <activity android:name=".share.BookmarkPickerActivity"
    android:label="@string/bookmark_picker_name"
    android:stateNotNeeded="true"/>
 <activity android:name=".share.AppPickerActivity"
    android:label="@string/app_picker_name"
    android:stateNotNeeded="true"/>
 <activity android:name=".HelpActivity"
    android:label="@string/menu_help"
    android:screenOrientation="user"
    android:stateNotNeeded="true"/>
 </application>

</manifest>

其實(shí)ZXing官方的項(xiàng)目已經(jīng)作為為第三方提供集成的代碼了,比如其中的關(guān)鍵Activity:.\src\com\google\zxing\client\android\CaptureActivity.Java,在聲明中已經(jīng)提供好了從各種入口訪問(wèn)的Intent的Action。所以在我們自己新建的MainActivity中,直接隱式指定一個(gè)Intent的Action,啟動(dòng)之即可: 

package com.google.zxing.client.android;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;

public class MainActivity extends Activity {

 private final int REQUEST_CODE = 0xa1;

 @Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);

 Intent intent = new Intent();
 //隱式指定
 intent.setAction("com.google.zxing.client.android.SCAN");
 
 //啟動(dòng)ZXing已經(jīng)寫(xiě)好、且我們做小量修改后的CaptureActivity。
 startActivityForResult(intent, REQUEST_CODE);
 }

 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
 super.onActivityResult(requestCode, resultCode, data);

 //我們需要的結(jié)果返回
 if (requestCode == REQUEST_CODE && resultCode == Activity.RESULT_OK) {

 //result就是二維碼掃描的結(jié)果。
 String result = data.getStringExtra("RESULT");

 Toast.makeText(getApplicationContext(), result, Toast.LENGTH_SHORT)
  .show();
 }
 }
}

因?yàn)槲覀儐?dòng)ZXing的CaptureActivity不是目的,真正的目的是啟動(dòng)ZXing的CaptureActivity獲得二維碼掃描結(jié)果,因此以startActivityForResult()的方式啟動(dòng)。相應(yīng)的,我們需要重寫(xiě):protected void onActivityResult(int requestCode, int resultCode, Intent data),以回調(diào)等待傳回結(jié)果。

(第4步):這一步是重點(diǎn)。在.\src\com\google\zxing\client\android\目錄下的CaptureActivity.java中的方法: public void handleDecode(Result rawResult, Bitmap barcode, float scaleFactor);此方法是一個(gè)回調(diào)函數(shù)。ZXing項(xiàng)目中寫(xiě)好的掃描模塊掃描后返回回調(diào)此方法,ZXing官方的原始 public void handleDecode(Result rawResult, Bitmap barcode, float scaleFactor)方法是這樣的: 

/**
 * A valid barcode has been found, so give an indication of success and show the results.
 *
 * @param rawResult The contents of the barcode.
 * @param scaleFactor amount by which thumbnail was scaled
 * @param barcode A greyscale bitmap of the camera data which was decoded.
 */
 public void handleDecode(Result rawResult, Bitmap barcode, float scaleFactor) {
 inactivityTimer.onActivity();
 lastResult = rawResult;
 ResultHandler resultHandler = ResultHandlerFactory.makeResultHandler(this, rawResult);

 boolean fromLiveScan = barcode != null;
 if (fromLiveScan) {
  historyManager.addHistoryItem(rawResult, resultHandler);
  // Then not from history, so beep/vibrate and we have an image to draw on
  beepManager.playBeepSoundAndVibrate();
  drawResultPoints(barcode, scaleFactor, rawResult);
 }

 switch (source) {
  case NATIVE_APP_INTENT:
  case PRODUCT_SEARCH_LINK:
  handleDecodeExternally(rawResult, resultHandler, barcode);
  break;
  case ZXING_LINK:
  if (scanFromWebPageManager == null || !scanFromWebPageManager.isScanFromWebPage()) {
   handleDecodeInternally(rawResult, resultHandler, barcode);
  } else {
   handleDecodeExternally(rawResult, resultHandler, barcode);
  }
  break;
  case NONE:
  SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
  if (fromLiveScan && prefs.getBoolean(PreferencesActivity.KEY_BULK_MODE, false)) {
   Toast.makeText(getApplicationContext(),
       getResources().getString(R.string.msg_bulk_mode_scanned) + " (" + rawResult.getText() + ')',
       Toast.LENGTH_SHORT).show();
   // Wait a moment or else it will scan the same barcode continuously about 3 times
   restartPreviewAfterDelay(BULK_MODE_SCAN_DELAY_MS);
  } else {
   handleDecodeInternally(rawResult, resultHandler, barcode);
  }
  break;
 }
 }

 我們將精簡(jiǎn)此方法,定制自己所需要的內(nèi)容,為滿足我們自己項(xiàng)目中的需求,把此方法修改后的代碼為:

 public void handleDecode(Result rawResult, Bitmap barcode, float scaleFactor) {
 inactivityTimer.onActivity();
 lastResult = rawResult;
 ResultHandler resultHandler = ResultHandlerFactory.makeResultHandler(this, rawResult);

 boolean fromLiveScan = barcode != null;
 if (fromLiveScan) {
  historyManager.addHistoryItem(rawResult, resultHandler);
  // Then not from history, so beep/vibrate and we have an image to draw on
  beepManager.playBeepSoundAndVibrate();
  drawResultPoints(barcode, scaleFactor, rawResult);
 }
 
 
 //在這里增加我們的代碼,目的是:做最小量的修改,僅僅把ZXing提供的CaptureActivity作為一個(gè)中間使用的Activity集成到我們自己的項(xiàng)目。
 //啟動(dòng)實(shí)現(xiàn)二維碼掃描,返回一個(gè)結(jié)果就可以了。
 //然后結(jié)束這個(gè)Activity。
 Intent intent=new Intent();
 //<key,value>形式存儲(chǔ)二維碼結(jié)果。
 //rawResult.getText()即為二維碼結(jié)果。
 intent.putExtra("RESULT", rawResult.getText());
 this.setResult(Activity.RESULT_OK, intent);
 this.finish();
 
 
 /**
 以下是ZXing提供的源碼,根據(jù)項(xiàng)目需要可以刪減使用。
 簡(jiǎn)單期間,我們只需要二維碼掃描后返回一個(gè)掃描的字符串結(jié)果。
 所以在次暫時(shí)注釋掉。
 
 switch (source) {
  case NATIVE_APP_INTENT:
  case PRODUCT_SEARCH_LINK:
  handleDecodeExternally(rawResult, resultHandler, barcode);
  break;
  case ZXING_LINK:
  if (scanFromWebPageManager == null || !scanFromWebPageManager.isScanFromWebPage()) {
   handleDecodeInternally(rawResult, resultHandler, barcode);
  } else {
   handleDecodeExternally(rawResult, resultHandler, barcode);
  }
  break;
  case NONE:
  SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
  if (fromLiveScan && prefs.getBoolean(PreferencesActivity.KEY_BULK_MODE, false)) {
   Toast.makeText(getApplicationContext(),
       getResources().getString(R.string.msg_bulk_mode_scanned) + " (" + rawResult.getText() + ')',
       Toast.LENGTH_SHORT).show();
   // Wait a moment or else it will scan the same barcode continuously about 3 times
   restartPreviewAfterDelay(BULK_MODE_SCAN_DELAY_MS);
  } else {
   handleDecodeInternally(rawResult, resultHandler, barcode);
  }
  break;
 }
 
 **/
 }

 (第5步):這一步比較簡(jiǎn)單,是剩余的收尾工作,修改AndroidManifest.xml文件,把我們的MainActivity作為主Activity啟動(dòng)。把ZXing的CaptureActivity作為一個(gè)普通的Activity。 

修改后的AndroidManifest.xml文件:

 <?xml version="1.0" encoding="UTF-8"?>
<!--
 Copyright (C) 2008 ZXing authors

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
   package="com.google.zxing.client.android"
   android:versionName="4.7.3"
   android:versionCode="103"
   android:installLocation="auto">

 <uses-permission android:name="android.permission.CAMERA"/>
 <uses-permission android:name="android.permission.INTERNET"/>
 <uses-permission android:name="android.permission.VIBRATE"/>
 <uses-permission android:name="android.permission.FLASHLIGHT"/>
 <uses-permission android:name="android.permission.READ_CONTACTS"/>
 <uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS"/>
 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
 <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

 <uses-sdk android:minSdkVersion="15" android:targetSdkVersion="21"/>

 <!-- Don't require camera, as this requires a rear camera. This allows it to work on the Nexus 7 -->
 <uses-feature android:name="android.hardware.camera" android:required="false"/>
 <uses-feature android:name="android.hardware.camera.front" android:required="false"/>
 <!-- TODO replace above two with next line after Android 4.2 -->
 <!-- <uses-feature android:name="android.hardware.camera.any"/> -->
 <uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
 <uses-feature android:name="android.hardware.camera.flash" android:required="false"/>
 <uses-feature android:name="android.hardware.screen.landscape"/>
 <uses-feature android:name="android.hardware.wifi" android:required="false"/>
 <!-- This excludes Google TV, which is unfortunately included by virtue of not requiring a camera -->
 <uses-feature android:name="android.hardware.touchscreen"/>
 <!-- TODO make this not required again after android.hardware.camera.any is available -->

 <supports-screens android:xlargeScreens="true"
     android:largeScreens="true"
     android:normalScreens="true"
     android:smallScreens="true"
     android:anyDensity="true"/>

 <application android:icon="@drawable/launcher_icon"
    android:logo="@drawable/launcher_icon"
    android:label="@string/app_name"
    android:allowBackup="true">
  
  
 <!-- 新增的我們自己的MainActiviy作為啟動(dòng)Activity -->
 <activity
   android:name=".MainActivity"
   android:label="@string/app_name" >
   <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
   </intent-filter>
 </activity>
  
  
 <activity android:name=".CaptureActivity"
    android:screenOrientation="sensorLandscape"
    android:clearTaskOnLaunch="true"
    android:stateNotNeeded="true"
    android:theme="@style/CaptureTheme"
    android:windowSoftInputMode="stateAlwaysHidden">
  
  <!-- 
  把ZXing官方提供的作為 main activity啟動(dòng)的CaptureActivity作為一個(gè)普通Activiy。
  
  <intent-filter>
  <action android:name="android.intent.action.MAIN"/>
  <category android:name="android.intent.category.LAUNCHER"/>
  </intent-filter>
  
  --> 
  
  
  <intent-filter>
  <action android:name="com.google.zxing.client.android.SCAN"/>
  <category android:name="android.intent.category.DEFAULT"/>
  </intent-filter>
  <!-- Allow web apps to launch Barcode Scanner by linking to http://zxing.appspot.com/scan. -->
  <intent-filter>
  <action android:name="android.intent.action.VIEW"/>
  <category android:name="android.intent.category.DEFAULT"/>
  <category android:name="android.intent.category.BROWSABLE"/>
  <data android:scheme="http" android:host="zxing.appspot.com" android:path="/scan"/>
  </intent-filter>
  <!-- We also support a Google Product Search URL. -->
  <intent-filter>
  <action android:name="android.intent.action.VIEW"/>
  <category android:name="android.intent.category.DEFAULT"/>
  <category android:name="android.intent.category.BROWSABLE"/>
  <data android:scheme="http" android:host="www.google.com" android:path="/m/products/scan"/>
  </intent-filter>
  <!-- And the UK version. -->
  <intent-filter>
  <action android:name="android.intent.action.VIEW"/>
  <category android:name="android.intent.category.DEFAULT"/>
  <category android:name="android.intent.category.BROWSABLE"/>
  <data android:scheme="http" android:host="www.google.co.uk" android:path="/m/products/scan"/>
  </intent-filter>
  <!-- Support zxing://scan/?... like iPhone app -->
  <intent-filter>
  <action android:name="android.intent.action.VIEW"/>
  <category android:name="android.intent.category.DEFAULT"/>
  <category android:name="android.intent.category.BROWSABLE"/>
  <data android:scheme="zxing" android:host="scan" android:path="/"/>
  </intent-filter>
 </activity>
 <activity android:name=".PreferencesActivity"
    android:label="@string/preferences_name"
    android:stateNotNeeded="true"/>
 <activity android:name=".encode.EncodeActivity"
    android:stateNotNeeded="true">
  <intent-filter>
  <action android:name="com.google.zxing.client.android.ENCODE"/>
  <category android:name="android.intent.category.DEFAULT"/>
  </intent-filter>
  <!-- This allows us to handle the Share button in Contacts. -->
  <intent-filter>
  <action android:name="android.intent.action.SEND"/>
  <category android:name="android.intent.category.DEFAULT"/>
  <data android:mimeType="text/x-vcard"/>
  </intent-filter>
  <!-- This allows us to handle sharing any plain text . -->
  <intent-filter>
  <action android:name="android.intent.action.SEND"/>
  <category android:name="android.intent.category.DEFAULT"/>
  <data android:mimeType="text/plain"/>
  </intent-filter>
 </activity>
 <activity android:name=".book.SearchBookContentsActivity"
    android:label="@string/sbc_name"
    android:stateNotNeeded="true"
    android:screenOrientation="sensorLandscape">
  <intent-filter>
  <action android:name="com.google.zxing.client.android.SEARCH_BOOK_CONTENTS"/>
  <category android:name="android.intent.category.DEFAULT"/>
  </intent-filter>
 </activity>
 <activity android:name=".share.ShareActivity"
    android:stateNotNeeded="true"
    android:screenOrientation="user">
  <intent-filter>
  <action android:name="com.google.zxing.client.android.SHARE"/>
  <category android:name="android.intent.category.DEFAULT"/>
  </intent-filter>
 </activity>
 <activity android:name=".history.HistoryActivity"
    android:label="@string/history_title"
    android:stateNotNeeded="true"/>
 <activity android:name=".share.BookmarkPickerActivity"
    android:label="@string/bookmark_picker_name"
    android:stateNotNeeded="true"/>
 <activity android:name=".share.AppPickerActivity"
    android:label="@string/app_picker_name"
    android:stateNotNeeded="true"/>
 <activity android:name=".HelpActivity"
    android:label="@string/menu_help"
    android:screenOrientation="user"
    android:stateNotNeeded="true"/>
 </application>

</manifest>

備注:此文僅僅是最簡(jiǎn)單的一個(gè)示例,演示了如何在自己的項(xiàng)目中在ZXing官方項(xiàng)目已提供的完整代碼基礎(chǔ)上,做最小量的改動(dòng),將二維碼掃描功能快速集成到自己的項(xiàng)目中為我所用,若需要更多的細(xì)節(jié)調(diào)整,則需要深入定制和改編源代碼。

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • Android使用OKHttp庫(kù)實(shí)現(xiàn)視頻文件的上傳到服務(wù)器功能

    Android使用OKHttp庫(kù)實(shí)現(xiàn)視頻文件的上傳到服務(wù)器功能

    這篇文章主要介紹了Android使用OKHttp庫(kù)實(shí)現(xiàn)視頻文件的上傳到服務(wù)器功能,需要的朋友可以參考下
    2018-03-03
  • Android音頻焦點(diǎn)管理實(shí)例詳解

    Android音頻焦點(diǎn)管理實(shí)例詳解

    音頻是個(gè)專業(yè)術(shù)語(yǔ),音頻一詞已用作一般性描述音頻范圍內(nèi)和聲音有關(guān)的設(shè)備及其作用,人類能夠聽(tīng)到的所有聲音都稱之為音頻,它可能包括噪音等,下面這篇文章主要給大家介紹了關(guān)于Android音頻焦點(diǎn)管理的相關(guān)資料,需要的朋友可以參考下
    2022-01-01
  • 關(guān)于Android 6.0權(quán)限的動(dòng)態(tài)適配詳解

    關(guān)于Android 6.0權(quán)限的動(dòng)態(tài)適配詳解

    Android 6.0版本(Api 23)推出了很多新的特性, 大幅提升了用戶體驗(yàn), 同時(shí)也為程序員帶來(lái)新的負(fù)擔(dān). 動(dòng)態(tài)權(quán)限管理就是這樣, 一方面讓用戶更加容易的控制自己的隱私, 一方面需要重新適配應(yīng)用權(quán)限,本文介紹了關(guān)于Android 6.0權(quán)限動(dòng)態(tài)適配的相關(guān)資料,需要的朋友可以參考下。
    2017-11-11
  • android使用PullToRefresh實(shí)現(xiàn)下拉刷新和上拉加載

    android使用PullToRefresh實(shí)現(xiàn)下拉刷新和上拉加載

    本篇文章主要介紹了android使用PullToRefresh實(shí)現(xiàn)下拉刷新和上拉加載,具有一定的參考價(jià)值,有興趣的可以了解一下。
    2016-12-12
  • android RecyclerView實(shí)現(xiàn)條目Item拖拽排序與滑動(dòng)刪除

    android RecyclerView實(shí)現(xiàn)條目Item拖拽排序與滑動(dòng)刪除

    本篇文章主要介紹了android RecyclerView實(shí)現(xiàn)條目Item拖拽排序與滑動(dòng)刪除,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下。
    2017-03-03
  • Android如何實(shí)現(xiàn)底部菜單固定到底部

    Android如何實(shí)現(xiàn)底部菜單固定到底部

    這篇文章主要介紹了Android如何實(shí)現(xiàn)底部菜單固定到底部,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-09-09
  • Android斬首行動(dòng)接口預(yù)請(qǐng)求

    Android斬首行動(dòng)接口預(yù)請(qǐng)求

    這篇文章主要為大家介紹了Android斬首行動(dòng)之接口預(yù)請(qǐng)求實(shí)現(xiàn)示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-03-03
  • Android.mk引入第三方j(luò)ar包和so庫(kù)文件的方法

    Android.mk引入第三方j(luò)ar包和so庫(kù)文件的方法

    這篇文章主要介紹了Android.mk引入第三方j(luò)ar包和so庫(kù)文件的方法,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2018-05-05
  • Android實(shí)現(xiàn)為圖片添加水印

    Android實(shí)現(xiàn)為圖片添加水印

    這篇文章主要為大家詳細(xì)介紹了Android實(shí)現(xiàn)為圖片添加水印的相關(guān)資料,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-02-02
  • Android開(kāi)發(fā)中使用achartengine繪制各種圖表的方法

    Android開(kāi)發(fā)中使用achartengine繪制各種圖表的方法

    這篇文章主要介紹了Android開(kāi)發(fā)中使用achartengine繪制各種圖表的方法,結(jié)合具體實(shí)例形式分析了Android基于圖表生成類庫(kù)achartengine進(jìn)行圖表繪制的具體步驟與相關(guān)操作技巧,需要的朋友可以參考下
    2017-10-10

最新評(píng)論

电白县| 五原县| 翁源县| 嘉禾县| 济南市| 淮阳县| 台江县| 淳化县| 东阿县| 栖霞市| 鸡西市| 江源县| 兰州市| 蓬安县| 卫辉市| 大安市| 永仁县| 潜山县| 文昌市| 吉安市| 正定县| 尖扎县| 崇阳县| 新巴尔虎左旗| 鄄城县| 崇明县| 山西省| 教育| 陕西省| 突泉县| 南阳市| 余庆县| 滨海县| 神农架林区| 阿城市| SHOW| 南康市| 鹿泉市| 固阳县| 仁化县| 龙川县|