Android Activity半透明効果
912 ワード
1. res/values/styles.xml
2. res/values/colors.xml
3.setContentView(R.layout.main);前setTheme(R.style.Transparent);
<?xml version="1.0" encoding="utf-8"?>
<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>
2. res/values/colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="transparent_background">#50000000</color>
</resources>
3.setContentView(R.layout.main);前setTheme(R.style.Transparent);