所以我的res/values/style.xml看起来像这样:
<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>
活动片段:
<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>
当我从根活动开始此活动时,布局会正确绘制,但背景仍然是黑色的。我尝试使用
@android:style/Theme.Translucent
,但该主题会继承调用活动(横向)的方向,这不是我想要的。编辑:
持有摄像头预览的应用程序设置为横向视图,因为在纵向方向上无法正确显示预览(参见旧的谷歌错误报告)。
我想做的是在相机表面持有者前放置一个独立的用户交互界面活动(此活动应设置为“纵向”,或者更好地设置为“传感器”)。
android:screenOrientation="portrait"
。 - CommonsWare