【发布时间】:2012-11-27 21:54:31
【问题描述】:
我正在设置一个具有两个视图的框架布局 - 一个是 ImageView,另一个是相机预览。代码如下:
public void setUpCamera(){
//Set cameraView as the camera preview class
cameraView = new CameraPreview(getApplicationContext());
//Set imageResult as an image
imageResult = new ImageView(getApplicationContext());
imageResult.setBackgroundColor(Color.GRAY);
//Prime the frame and buttons from the xml file
frameLayout = (FrameLayout) findViewById(R.id.camera_preview);
snapPhoto = (Button) findViewById(R.id.button_capture);
//Add both camera preview and the snapped picture to the FrameLayout in the xml file
frameLayout.addView(imageResult);
frameLayout.addView(cameraView);
frameLayout.bringChildToFront(imageResult);
现在我的问题是是否可以将 cameraView “隐形”添加到 FrameLayout?这是一件小事,但否则在设置相机时,您会在通过bringChildToFront 方法突出显示图像之前获得相机预览模式的闪光。
任何想法将不胜感激!
【问题讨论】:
标签: android android-layout android-camera