今天在開發過程中發現主題設為dialog的activity總會出現一個黑框,在布局檔案中無法去掉,于是隻能修改activity的主題設定
<style name="translucent" parent="@android:style/Theme.Dialog">
<item name = "android:windowBackground">@color/translucent_background</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowAnimationStyle">@+android:style/Animation.Translucent</item>
</style>
顔色
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="translucent_background">#00000000</color>
</resources>
這樣引入主題translucent作為activity的theme就解決了标題的問題。
究其原因是因為dialog這個主題有預設的背景設定。。。。