我正在使用Zbar阅读QRCode.我将这个https://github.com/DushyanthMaguluru/ZBarScanner示例用于我的活动.问题是如何在FrameLayout上显示cameraView?
编辑:
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
mCamera = getCameraInstance();
if(!isCameraAvailable())
{
cancelRequest();
return;
}
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
mAutoFocusHandler = new Handler();
setupScanner();
mPreview = new CameraPreview(this, this, autoFocusCB);
//setContentView(mPreview);
FrameLayout preview = (FrameLayout)findViewById(R.id.cameraPreview);
preview.addView(mPreview);
}
Run Code Online (Sandbox Code Playgroud)