androidzxing二維碼掃描
Ⅰ Android中使用zxing的二維碼掃描,怎麼讓掃描區域大於view畫的區域
修改zxing.camera.CameraManager。具體自己查看裡面的方法,挺清楚的。
修改樣式的話,改ViewFinderView類。
Ⅱ android怎麼zxing 二維碼掃描
第一部分:Zxing的集成
步驟一:下載所需要的Zxing精簡版,在Github上搜索Zxing,看到這條記錄
進入並下載其jar包:
步驟二:復制到項目中,解壓下載的包到ZXingProj/src/com/dtr目錄下,復制這個zxing文件夾到項目中,這個時候你會看到有幾個紅線錯誤
接著一個個來修改這些紅色錯誤,主要錯誤包括:導入的R包不是本項目的,存在R.raw和R.id和R.layout的資源找不到。首先把該放進去的資源先放進去,復制libs中的zxing.jar包到項目中,記得右鍵AddAsLibrary
復制下載的res的layout文件、res的values的ids文件、raw文件、res的drawable-xhdpi文件到項目的對應位置
打開ResultActivity文件:
[java] view plain
public class ResultActivity extends Activity {
private ImageView mResultImage;
private TextView mResultText;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_result);
Bundle extras = getIntent().getExtras();
mResultImage = (ImageView) findViewById(R.id.result_image);
mResultText = (TextView) findViewById(R.id.result_text);
if (null != extras) {
int width = extras.getInt("width");
int height = extras.getInt("height");
LayoutParams lps = new LayoutParams(width, height);
lps.topMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 30, getResources().getDisplayMetrics());
lps.leftMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20, getResources().getDisplayMetrics());
lps.rightMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20, getResources().getDisplayMetrics());
mResultImage.setLayoutParams(lps);
String result = extras.getString("result");
mResultText.setText(result);
Bitmap barcode = null;
byte[] compressedBitmap = extras.getByteArray(DecodeThread.BARCODE_BITMAP);
if (compressedBitmap != null) {
barcode = BitmapFactory.decodeByteArray(compressedBitmap, 0, compressedBitmap.length, null);
// Mutable :
barcode = barcode.(Bitmap.Config.RGB_565, true);
}
mResultImage.setImageBitmap(barcode);
}
}
}
Ⅲ Android用Zxing編寫一個二維碼掃描的軟體時如何處理掃描的不同類型結果
二維碼裡面存儲的都是文本,只不過有些二維碼在生成的時候加了點兒格式而已,你可以在網上隨便找兩個在線生成二維碼的,然後生成二維碼,用你自己的項目掃描,你就可以看出這些格式了,然後在你的掃描結果上進行判斷,如果符合某某特徵,就執行某個操作,比如是網址就直接調用瀏覽器打開,如果是簡訊就直接發送簡訊附加上內容。。。
Ⅳ Android 二維碼掃描怎樣實現第二次掃描
二次掃描, 你是想要連接掃描吧, android 如果是用zxing掃描庫的話是可以實現的
Ⅳ android zxing怎麼掃描二維碼和條形碼
http://repo1.maven.org/maven2/com/google/zxing/android-core/3.2.1/android-core-3.2.1.jar導入這個jar包,使用方法見GitHub
https://github.com/zxing/zxing
