res/values/styles.xml
Xml代码
1.<resources>
2. <style name="Transparent
3.">
4. <item name="android:windowBackground">@color/transparent_background</item>
5. <item name="android:windowNoTitle">true</item>
6. <item name="android:windowIsTranslucent">true</item>
7. <item name="android:windowAnimationStyle">@+android:style/Animation.Translucent</item>
8. </style>
9.</resources>
<resources>
<style name="Transparent
">
<item name="android:windowBackground">@color/transparent_background</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@+android:style/Animation.Translucent</item>
</style>
</resources> res/values/color.xml
Xml代码
1.<?xml version="1.0" encoding="utf-8"?>
2.<resources>
3. <color name="transparent_background">#50000000</color>
4.</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="transparent_background">#50000000</color>
</resources>
注意:color.xml的#5000000前两位是透明的效果参数从00--99(透明--不怎么透明),后6位是颜色的设置
YXvKDw'95
manifest.xml
Xml代码
1.<activity android:name=".TransparentActivity" android:theme="@style/Transparent">
2.</activity>
<activity android:name=".TransparentActivity" android:theme="@style/Transparent">
</activity>
java代码
Java代码
1.public void onCreate(Bundle savedInstanceState) {
2. super.onCreate(savedInstanceState);
3. setTheme(R.style.Transparent);
4. setContentView(R.layout.transparent);
5.}
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTheme(R.style.Transparent);
setContentView(R.layout.transparent);
} 配置结束!