3

I have a 'Portrait mode' tabbed based application that contains a SurfaceView (with a camera preview on it) within one of the tabs. I have been creating my camera code from the Android API Demos and I have it all set-up working correctly bar one thing. The resulting camera preview is stretched and scaled making the preview look off.

Ideally I want to render the SurfaceView at the native preview size defined by the camera within the tab. However that would involve making the contents of the tab larger than its parent! (Or rather larger than the FrameLayout the tab activities are contained in).

How can I go about Achieving this?

Image of problem: enter image description here

Kolky
  • 2,917
  • 1
  • 21
  • 42
Alex D
  • 41
  • 3

1 Answers1

0

Make the FrameLayout the root object, then pile the camera view in it, then header and the tab widget. You may have to do some fancy work with gravity settings and stacking the header/footer in linear layouts but it definitely is possible.

aka:

frame.addView(cameraPreview);
frame.addView(header);
frame.addView(footer);

This will draw the objects in layers.

EDIT: If you don't want to use your current frame layout, just make another one. Stack the header, frame layout, and footer inside a linear layout. Create a new frame layout, add the linear layout to it, then add the preview onto it to draw over it.

Slynk
  • 527
  • 5
  • 9