window – What is an Android DecorView?-ThrowExceptions

Exception or error:

Retrieve the top-level window decor view (containing the standard window
frame/decorations and the client’s content inside of that), which can be added as a
window to the window manager.

This is baffling. It is not clear what the standard “window frame/decorations” are. I’m at a loss as to what this is, exactly, and the documentation is terrible. Does it exist inside the application’s window? Does it surround the application’s window?

I have never seen an Android window with noticeable window decorations. And “which can be added as a window” implies that a decor view is a window, but that contradicts the class hierarchy (View is not a subclass of Window).

So what’s the deal? What exactly is the decor view?

How to solve:

Seems that one of the places where it’s best defined is in Romain Guy’s Blog:

The DecorView is the view that actually holds the window’s background drawable. Calling getWindow().setBackgroundDrawable() from your Activity changes the background of the window by changing the DecorView‘s background drawable. As mentioned before, this setup is very specific to the current implementation of Android and can change in a future version or even on another device.

Leave a Reply

Your email address will not be published. Required fields are marked *