参考从源码角度剖析 setContentView() 背后的机制 https://juejin.im/post/58dcd12e61ff4b006b051908
1 AppCompatDelegateImplV9.java
public void setContentView(int resId) {
ensureSubDecor();
ViewGroup contentParent = (ViewGroup) mSubDecor.findViewById(android.R.id.content);
contentParent.removeAllViews();
LayoutInflater.from(mContext).inflate(resId, contentParent);
mOriginalWindowCallback.onContentChanged();
}