Skip to content Skip to sidebar Skip to footer

Get Access To Zxing Qr Scanner Camera View

I am new to android development and I am working on an android project where I have to integrate QR scanner. So I thought I would integrate Zxing QR scanner and came across this li

Solution 1:

Instead of just adding this lib as a jar using gradle's

compile'me.dm7.barcodescanner:zxing:1.6.3'

you could clone the project from github or download a zip and uzip it and integrate to your project as a lib project. And then make any desired changes in its sources and its layouts.

Solution 2:

ZXingScannerView extends BarcodeScannerView. You can access this by going to the declaration of ZXingScannerView (in Android Studio Ctrl+B).

publicclassZXingScannerViewextendsBarcodeScannerView {
private MultiFormatReader mMultiFormatReader;
publicstaticfinal List<BarcodeFormat> ALL_FORMATS = newArrayList();
private List<BarcodeFormat> mFormats;
private ZXingScannerView.ResultHandler mResultHandler;

If you go the declaration of BarcodeScannerView, you'll notice a method called setupLayout() which formats the layout:

public void setupLayout() {
    this.mPreview = new CameraPreview(this.getContext());
    this.mViewFinderView = new ViewFinderView(this.getContext());
    RelativeLayout relativeLayout = new RelativeLayout(this.getContext());
    relativeLayout.setGravity(17);
    relativeLayout.setBackgroundColor(-16777216);
    relativeLayout.addView(this.mPreview);
    this.addView(relativeLayout);
    this.addView(this.mViewFinderView);
}

By going to the declaration of "CameraPreview" you'll be able to get more info for how the camera is laid out and you could maybe extend ZXingScannerView to edit the layout.

Hope this helps!

Cheers!

Solution 3:

Well in your case i would try to include the layout into another layout, maybe it helps:

<LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:orientation="vertical"android:layout_width=”match_parent”android:layout_height=”match_parent”android:background="@color/app_bg"android:gravity="center_horizontal"><includelayout="@layout/titlebar"/><TextViewandroid:layout_width=”match_parent”android:layout_height="wrap_content"android:text="@string/hello"android:padding="10dp" />

    ...

</LinearLayout>

And of course there is information about that here ;)

Post a Comment for "Get Access To Zxing Qr Scanner Camera View"