我在qr代码扫描程序项目中工作。现在我需要为qr代码扫描程序创建custum布局是否可以使用zing?关于这个的任何教程/代码?
答案 0 :(得分:0)
这里试试这个
compile 'com.journeyapps:zxing-android-embedded:3.0.3@aar'
compile 'com.google.zxing:core:3.2.0'
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.journeyapps.barcodescanner.CompoundBarcodeView
android:id="@+id/barcode_scanner"
android:layout_width="match_parent"
android:layout_height="match_parent">
</com.journeyapps.barcodescanner.CompoundBarcodeView>
</LinearLayout>
在您的活动或片段中
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_page_three, container, false);
barcodeView = (CompoundBarcodeView) view.findViewById(R.id.barcode_scanner);
barcodeView.decodeContinuous(callback);
return view;
}
回调
private BarcodeCallback callback = new BarcodeCallback() {
@Override
public void barcodeResult(BarcodeResult result) {
String resultString = result;
}