My application should hold a camera preview surface. The camera is fixed to landscape view via AndroidMainfest.xml
<application android:icon="@drawable/icon"
android:label="Camera">
<uses-library android:name="com.google.android.maps" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<activity android:name=".CameraPreview"
android:label="Camera"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
If there is another way to get the camera preview itself to behave correctly, please let me know.
Now I need to have an overlay that holds a bunch of buttons. Due to usability, the user interface should be set to portrait view (or even better orientation aware).
Is there a way to have a transparent layout (for buttons and other GUI elements) in portrait orientation?
I tried to write a special rotated layout by extending a RelativeLayout, but the onDraw method isn't called at anytime.
public class RotatedOverlay extends RelativeLayout {
private static final String TAG = "RotatedOverlay";
public RotatedOverlay(Context context, AttributeSet attrs ) {
super(context, attrs);
}
@Override
protected void onDraw(Canvas canvas) {
canvas.rotate(90);
super.onDraw(canvas);
}
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 (even studied the native Camera implementation), but couldnt find a good solution so far.
Maybe it works with two seperate Activities, but I dont think, that this can the right solution.