View繪制的三部曲, 測量,布局,繪畫
今天我們分析測量過程
view的測量是從ViewRootImpl發(fā)起的,View需要重繪,都是發(fā)送請求給ViewRootImpl,然后他組織重繪
在重繪的過程中,有一步就是測量,通過代碼來分析測量過程
private boolean measureHierarchy(final View host, final WindowManager.LayoutParams lp, final Resources res, final int desiredWindowWidth, final int desiredWindowHeight) { int childWidthMeasureSpec; int childHeightMeasureSpec; boolean windowSizeMayChange = false; if (DEBUG_ORIENTATION || DEBUG_LAYOUT) Log.v(TAG, "Measuring " + host + " in display " + desiredWindowWidth + "x" + desiredWindowHeight + "..."); boolean goodMeasure = false; if (lp.width == ViewGroup.LayoutParams.WRAP_CONTENT) { // On large screens, we don't want to allow dialogs to just &n