0% found this document useful (0 votes)
9 views1 page

Window, ViewRootImpl, Surface, Canvas, View, DecorView, ViewTreeObserver, TouchEvent, SurfaceView - Medium2

The document discusses the key components of the PhoneWindow class in Android, focusing on its two main parameters: DecorView and ViewGroup. DecorView serves as the root container for an Activity's view hierarchy, while mContentParent holds the UI elements of the window. The document also mentions how to change the window's background using the setBackgroundDrawable method.

Uploaded by

lza1047771038
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views1 page

Window, ViewRootImpl, Surface, Canvas, View, DecorView, ViewTreeObserver, TouchEvent, SurfaceView - Medium2

The document discusses the key components of the PhoneWindow class in Android, focusing on its two main parameters: DecorView and ViewGroup. DecorView serves as the root container for an Activity's view hierarchy, while mContentParent holds the UI elements of the window. The document also mentions how to change the window's background using the setBackgroundDrawable method.

Uploaded by

lza1047771038
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

2025/3/17 20:22 Window, ViewRootImpl, Surface, Canvas, View, DecorView, ViewTreeObserver, TouchEvent, SurfaceView | Medium

// ...
}

PhoneWindow has 2 important parameters DecorView and ViewGroup .

private DecorView mDecor;

ViewGroup mContentParent;

DecorView is the inner class of PhoneWindow and is the root container in the View

hierarchy for an Activity . DecorView extends FrameLayout .

For example: A DecorView contains a window background that can be drawn, and
calling the getWindow().setBackgroundDrawable(Drawable drawable) method from your
Activity changes the window’s background.

mContentParent stores the View in which the contents of the window are placed.
Those are essentially the root container for the UI elements that we add to our
Activity.

https://medium.com/@MrAndroid/android-window-basic-concepts-a11d6fcaaf3f 2/33

You might also like