前言 View的绘制过程分为 measure.layout.draw三个步骤,接下来对这三个步骤逐一进行研究. measure方法的签名 public final void measure(int widthMeasureSpec, int heightMeasureSpec); measure方法用来测量View的尺寸.两个参数widthMeasureSpec/heightMeasureSpec声明了Parent View所能提供的宽/高. 需要注意的是,widthMeasureSpec/he
1.在阅读源码的时候经常发现有一些标志属性使用一些位操作来判断是否具有该标志,增加标志或者去除标志. 比如View.java中的 /** * This view does not want keystrokes. Use with TAKES_FOCUS_MASK when * calling setFlags. */ private static final int NOT_FOCUSABLE = 0x00000000; /** * This view wants keystrokes. Us