在res/values/新建文件colors.xml
寫入下面代碼
<resources>
<drawable name="translucent_background">#7F000000</drawable>
</resources>
一樣新建styles.xml文件添加如下代碼
<resources>
<style name="transparent">
<item name="android:windowBackground">@drawable/translucent_background</item>
<item name="android:windowIsTranslucent">true</item>
</style>
</resources>
最後修改Androidmanifest.xml文件
在activity裏面添加紅色代碼,那麼該activity就透明瞭
<activity android:name=".WordSearch"
android:label="@string/app_name"
android:theme="@style/transparent">
</activity>
顏色知識:#7F000000,其中前兩位字符表示透明度(00—FF),後面六位表示顏色(000000黑 ,FFFFFF白)
listview滑動時透明能夠修改listview的屬性
android:cacheColorHint = "#00000000"