How can I add a portrait layout on top of a landscape Camera SurfaceView?

Posted by user319919 on Stack Overflow See other posts from Stack Overflow or by user319919
Published on 2010-04-19T01:12:43Z Indexed on 2010/04/19 1:13 UTC
Read the original article Hit count: 313

I need a Camera SurfaceView for my application. The camera should be set to fixed landscape view which is done by setting

android:screenOrientation="landscape"

for the activity in the AndroidManifest.xml.

After doing some experiments and Google researches trying to use setRotation(int) inside the camera preview implementation, I came to the conclusion, that it is obviously the common practice to get a preview with correct behaviour.

Now the camera preview itself looks fine for landscape orientation. But I need to have an overlay that holds a bunch of buttons. Due to usability the user interface should be in portrait view (or even better orientation aware). There seemed no other option to me, but to fix the activity screenOrientation, so that the camera preview looks normal (in portrait mode the whole view is streched and rotated to the left) Is there a workaround to get my buttons back to portrait orientation? Or another overall approach to deal with the camera view? Parameters.setRotation(int) obvisouly didnt work.

I am quite new to the Android plattform programming. Of course I dont know much about the programming tricks and workarounds yet. I did a lot of research over the last two weeks, but couldnt find the right solution so far.

© Stack Overflow or respective owner

Related posts about android

Related posts about android-layout