1 最外层 Activity
2 PhoneWindow(一个activity 拥有一个PhoneWindow)
3 DecorView (一个PhoneWindow对应一个DecorView )
这个DecorView 就是我们能看到的界面的根view,一个FrameLayout的ViewGroup.
DecorView 也是有对应的xml的 会根据我们设置的参数 来决定使用哪个布局
这个方法在PhoneWindow 的 generateLayout(DecorView decor) 方法中
这个是其中一个简单的布局
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical">
<ViewStub android:id="@+id/action_mode_bar_stub"
android:inflatedId="@+id/action_mode_bar"
android:layout="@layout/action_mode_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="?attr/actionBarTheme" />
<FrameLayout
android:id="@android:id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:foregroundInsidePadding="false"
android:foregroundGravity="fill_horizontal|top"
android:foreground="?android:attr/windowContentOverlay" />
</LinearLayout>
我们自己setContentView 设置的内容 之后都会添加到 android:id="@android:id/content"这个FrameLayout, 所有有很多添加loading的框架 都是直接在这个FrameLayout 中添加东西 覆盖在自己的内容上面