把Activity背景色设置为透明色:
res/values/styles.xml:
<style name="Transparent"> <item name="android:windowBackground">@color/transparent_background</item> <item name="android:windowNoTitle">true</item> <item name="android:windowIsTranslucent">false</item> </style>
res/values/colors.xml:
<color name="transparent_background">#50000000</color>
在AndroidManifest.xml文件,Activity标签中添加theme样式为自定义的“Transparent”样式:
<activity android:name="com.llvision.app.RemoteCameraActivity" android:theme="@style/Transparent" android:screenOrientation="portrait"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>
本文介绍如何通过修改Android项目的styles.xml和colors.xml文件来实现Activity背景的透明效果,并展示了如何在AndroidManifest.xml中指定该样式。
2036

被折叠的 条评论
为什么被折叠?



