LinearLayout源码笔记

 onMeasure()会调用measureVertical(int widthMeasureSpec, int heightMeasureSpec)

 mTotalLength保存已经measure过的child所占用的高度

void measureChildBeforeLayout(View child, int childIndex,

            int widthMeasureSpec, int totalWidth, int heightMeasureSpec,

            int totalHeight) //对每一个child进行测量, heightMeasureSpec为LinearLayout本身的measureSpec,totalHeight为

LinearLayout已经被其他子试图所占用的高度

 

measureChildWithMargins(View child,

            int parentWidthMeasureSpec, int widthUsed,

            int parentHeightMeasureSpec, int heightUsed) 

 

child.getMeasuredHeight()获取该子试图的最终高度 

 

ViewGroup.getChildMeasureSpec(int spec, int padding, int childDimension) 

View.resolveSizeAndState(int size, int measureSpec, int childMeasuredState)  

 

 

你可能感兴趣的:(LinearLayout)