requestLayout(): 重新布局整个ViewTree,开始调用measure()方法。 requestLayout()是view的方法,view也可以调用该方法。
Call this when something has changed which has invalidated the layout of this view. This will schedule a layout pass of the view tree. This should not be called while the view hierarchy is currently in a layout pass.invalidate(): 如果当前View可见,onDraw()方法将会被调用。
Invalidate the whole view. If the view is visible, onDraw() will be called at some point in the future.This must be called from a UI thread. To call from a non-UI thread, call postInvalidate().在写SimpleIndicator时,并不是一定不会走onMeasure()方法,在某种条件下会走该方法的。可以搜其他的源码分析文章,具体查看。源码分析
新闻热点
疑难解答