Zbar android改为纵向模式

时间:2015-01-19 14:14:01

标签: android zbar

我在Android Studio的项目中使用Zbar,我有两个问题:

1.如何将Zbar库设置为在纵向模式下正常工作。

2.如何设置扫描区域(相机预览)不是全屏,并添加按钮。

我已阅读本手册:how to customize CameraView for android ZBar QrCode Reader,并在 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);
}

但它不起作用。

0 个答案:

没有答案