I’m setting up a frame layout that has two views – one is an ImageView and the other is a camera preview. Here’s the code:
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);
Now my question is whether it’s possible to add the cameraView “invisibly” to the FrameLayout? It’s a small thing, but otherwise when the camera is set up you get a flash of the camera preview mode before the image is brought to the fore by the bringChildToFront method.
Any ideas would be much appreciated!
Are you after
setVisibility(View.GONE)orsetVisibility(View.INVISIBLE)?GONE adjusts your layout as if the View wasn’t completely missing, INVISIBLE maintains any spacing.