View轉化成bitmap保存成圖片

View轉化成bitmap保存成圖片

Android中Activity啓動過程探究

case LAUNCH_ACTIVITY: {
    final ActivityClientRecord r = (ActivityClientRecord) msg.obj;
    r.packageInfo = getPackageInfoNoCheck(
            r.activityInfo.applicationInfo, r.compatInfo);
    handleLaunchActivity(r, null, "LAUNCH_ACTIVITY");
private void handleLaunchActivity(ActivityClientRecord r, Intent customIntent, String reason) {
    Activity a = performLaunchActivity(r, customIntent);
    if (a != null) {
        r.createdConfig = new Configuration(mConfiguration);
        reportSizeConfigurations(r);
        Bundle oldState = r.state;
        handleResumeActivity(r.token, false, r.isForward,
                !r.activity.mFinished && !r.startsNotResumed, r.lastProcessedSeq, reason);
    }
}

比較重要的兩個方法 一個 performLaunchActivity(),另外一個是handleResumeActivity()html

performLaunchActivity()中:app

attach( )   // 建立window 其與Activity的顯示相關佈局

onCreate();   // setContentView( ) 解析xml中view 並與decorview產生關聯spa

handleResumeActivity()中:.net

執行activity中的onResume方法,將WindowManager將DecorView添加到Window中orm

將decorview添加到ViewRootImpl中,並有decorview執行測量、佈局、繪製等操做。xml

相關文章
相關標籤/搜索