setContentView()
,android增加你的VIEW在activity的WINDOW上。 这个窗口并不只包含你的VIEW。 DecorView LinearLayout FrameLayout FrameLayout TextView FrameLayout .. .... DecorView实际上hold这window的背景drawble.可以通过getWindow().setBackgroundDrawable() 从activity中改变windows的背景图。如果你用默认的android theme,一个默认的背景drawable将被设置到你的activity上。 这个drawable目前是一个ColorDrawable(好像是灰黑色的)。对于大多数application,这个背景图能工作很好可以被保留。 但是能影响点性能。 如果你在你的activity上设置一个不透明的背景图,那么在你后面的DecorView的背景图也就是默认窗口的背景图就不可见了,那么 画他就没意义了。 删除这个背景很容易:This drawable is simply referenced by the theme:
<resources>
<style name="Theme.Shelves" parent="android:Theme">
<item name="android:windowBackground">@drawable/background_shelf</item>
<item name="android:windowNoTitle">true</item>
</style>
</resources>
android:theme="@style/Theme.NoBackground"
<activity />
<application />
MapView
WebView
res/drawable/background_shelf.xml
<resources>
<style name="Theme.Shelves" parent="android:Theme">
<item name="android:windowBackground">@drawable/background_shelf</item>
<item name="android:windowNoTitle">true</item>
</style>
</resources>