天天看點

android設定背景色為透明

android設定背景色為透明

方法一:

隻要在配置檔案内activity屬性配置内加上

android:theme="@android:style/Theme.Translucent"      

就好了。

這樣就調用了android的透明樣式!

方法二:

先在res/values下建colors.xml檔案,寫入:

 

<?xmlversion="1.0"encoding="UTF-8"?>
   
   <resources>
   
   <colorname="transparent">#9000</color>
   
   </resources>      
<?xmlversion="1.0"encoding="utf-8"?>
   
   <resources>
   
   <stylename="Transparent">
   
   <itemname="android:windowBackground">@color/transparent</item>
   
   <itemname="android:windowIsTranslucent">true</item>
   
   <itemname="android:windowAnimationStyle">@+android:style/Animation.Translucent</item>
   
   </style>
   
   </resources>      
android:theme="@style/transparent"