把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>