3

Im using Zbar on my project in Android Studio, i have 2 questions :

1.How can i set Zbar library to work correctly in portrait mode.

2.How can i set scan area(camera preview )not in fullscreen, and add a button .

I have read this manual: how to customize CameraView for android ZBar QrCode Reader , and add code in ZBarScannerActivity :

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

    if(!isCameraAvailable()) {
        // Cancel request if there is no rear-facing camera.
        cancelRequest();
        return;
    }

    // Hide the window title.
    //requestWindowFeature(Window.FEATURE_NO_TITLE);
    //getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

    mAutoFocusHandler = new Handler();

    // Create and configure the ImageScanner;
    setupScanner();

    // Create a RelativeLayout container that will hold a SurfaceView,
    // and set it as the content of our activity.
    mPreview = new CameraPreview(this, this, autoFocusCB);
    LinearLayout zbarLayout = (LinearLayout) findViewById(R.id.zbar_layout_area);
    mPreview.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    setContentView(mPreview);
}

but it dont work.

Community
  • 1
  • 1
Ololoking
  • 1,577
  • 4
  • 22
  • 37

0 Answers0