Android庖丁解牛之WindowBackground

What's the difference between windowBackground and background for activities style?

android:background is the background color (drawable to be precise) of a view component where as android:windowBackground is the background color of the window (activity or dialog) in which your view resides.


By default view's are transparent i.e no background color so visually it looks like they are taking the color from the underlying window.

Notice how the article you linked to mentions setting the windowBackground to null and not the background for fullscreen views.This is a common technique to avoid overdraws.

But the same principle can be applied to views if you have one view completely hide the other view.

 

自定义Theme中将android:windowBackground置为null,能小幅提升界面的绘制效率

猜你喜欢

转载自vvlavida.iteye.com/blog/1974936