Activity、Window、View、Surface[0]日志

来源:互联网 发布:金山快盘网络错误 编辑:程序博客网 时间:2024/05/18 01:15

基于android-2.3.3_r1源代码,跟踪一下App进程从主线程ActivityThreadmain()方法开始的执行流程

 

使用布局文件如下

<?xml version="1.0"encoding="utf-8"?>
<com.example.root.myapplication.MyFrameLayout
   
xmlns:android="http://schemas.android.com/apk/res/android"
   
xmlns:tools="http://schemas.android.com/tools"
   
android:layout_width="match_parent"
   
android:layout_height="match_parent"
   
tools:context="com.example.root.myapplication.MainActivity">

       <com.example.root.myapplication.MyTextView
           
android:id="@+id/tv"
           
android:layout_width="wrap_content"
           
android:layout_height="wrap_content"
           
android:text="Hello World!"
           
android:background="@android:color/white"
           
android:textColor="@android:color/black"/>

</com.example.root.myapplication.MyFrameLayout>

使用FrameLayoutTextView是因为其measure()layout()相对简单一些

 

执行流程如下