Android view测量过程包括
1.view.measure(int widthMeasureSpec,int heightMeasureSpec)测量空间的大小
这个方法需要两个参数,宽度和高度,因为父元素知道剩余的屏幕大小,所以传给子元素的值就确定了,而且这些值还含有MeasureSpec模式的信息
它常用的三个函数:
1.staticint getMode(int measureSpec):根据提供的测量值(格式)提取模式(上述三个模式之一)
2.staticint getSize(int measureSpec):根据提供的测量值(格式)提取大小值(这个大小也就是我们通常所说的大小)
3.staticint makeMeasureSpec(int size,int mode):根据提供的大小值和模式创建一个测量值(格式)
MeasureSpec.EXACTLY 和MeasureSpec.AT_MOST的却别
wrap_content 传进去的是AT_MOST
110dip或fill_parent 传入的模式是EXACTLY
2.view.layout()决定view在父view中的位置