Android Activity中的 DecorView

1.DecorView的LayoutParams的类型是WindowManager.LayoutParams

2.DecorView的宽高是由屏幕的宽高和其LayoutParams共同决定的

childWidthMeasureSpec = getRootMeasureSpec(desiredWindowWidth, lp.width);
childHeightMeasureSpec = getRootMeasureSpec(desiredWindowHeight, lp.height);
performMeasure(childWidthMeasureSpec, childHeightMeasureSpec);
其中desiredWindowWidth和desiredWindowHeight代表屏幕的尺寸,lp代表DecorView的layoutParams

3.DecorView的LayoutParams是由Window(即PhoneWindow)创建的,通过WindowManager的

addView(@NonNull View view, @NonNull ViewGroup.LayoutParams params)
添加进去的.
4.在WinowManager#addView中会对DecorView以及其子View进行measure,layout,draw等操作
5.在Activity中WindowManager#addView是在onResume方法之后调用的.因此在onResume是无法获得View的宽高.