2014.1.7 View onMeasure measure

1,onMeasure(widthMeasureSpec,heightMeasureSpec),由view的measure方法回调,其参数由measure(widthMeasureSpec,heightMeasureSpec)传入,自定义的view在onMeasure中必须调用setMeasuredDimension(),否则会报错。widthMeasureSpec、heightMeasureSpec,由MeasureSpec得到,有mode和size。subview根据父类的mode、size决定自己view的大小,通过setMeasuredDimension方法将大小告知父布局。

2,

3,

4,

5,

你可能感兴趣的:(2014.1.7 View onMeasure measure)