Android DecorView与ViewRootImpl

原创
2017/05/07 12:52
阅读数 905

结构关系

ViewRootImpl单独是一个普通类,不是视图类。没有继承View。

DecorView是PhoneWindow的一个内部类,是一个视图类继承FrageLayout(ViewGroup).

ViewRootImpl.java
public final class ViewRootImpl implements ViewParent,
        View.AttachInfo.Callbacks, HardwareRenderer.HardwareDrawCallbacks {
    //...
    ...
}


PhoneWindow.java
public class PhoneWindow extends Window implements MenuBuilder.Callback {
    
    private final class DecorView extends FrameLayout implements RootViewSurfaceTaker {
      //...
      ...
    }
   
}

Window.java
public abstract class Window {
    //
    ...
}

 

    // This is the view in which the window contents are placed. It is either
    // mDecor itself, or a child of mDecor where the contents go.
    private ViewGroup mContentParent;

    private void installDecor() {
        if (mDecor == null) {
            mDecor = generateDecor();
            mDecor.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
            mDecor.setIsRootNamespace(true);
            if (!mInvalidatePanelMenuPosted && mInvalidatePanelMenuFeatures != 0) {
                mDecor.postOnAnimation(mInvalidatePanelMenuRunnable);
            }
        }
        if (mContentParent == null) {
            mContentParent = generateLayout(mDecor);

            ...
        }
    }

 

展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部