My use case is writing an overlay controller activity for a landscape camera preview. I followed the instructions from a couple of tutorials for writing a transparent theme.
So my res/values/style.xml looks like this:
<resources>
<style name="Theme" parent="android:Theme" />
<style name="Theme.Transparent">
<item name="android:windowBackground">@drawable/transparent_background</item>
</style>
<drawable name="transparent_background">#00000000</drawable>
</resources>
The activity snippet:
<activity android:name=".CameraPreview"
android:label="Camera"
android:screenOrientation="landscape"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Controlls"
android:label="Controlls"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Translucent">
</activity>
When I start this activity from my root activity, the layout gets drawn correctly, but the background stays black. I tried to use @android:style/Theme.Translucent
instead, but this Theme inherits the orientation from the calling activity (landscape) and thats not what I want.
Edit:
The application holding the camera preview is set to landscape view as it does not display the preview correctly in portrait orientation. (see old google bug report)
What I wanted to do was to put an independent activity for user interaction interface in front of the camera surface holder (this activity should be set to 'portrait', or even better to 'sensor')