dispatchdraw专题

View中的draw和onDraw,dispatchDraw的区别

Android的view组件显示主要经过mesure, layout和draw这三个过程。在mesure阶段里调用mesure(int widthSpec, int heightSpec)方法,这个方法是final不能被重写,在这个过程里会调用onMesure(int widthSpec, int heightSpec)方法。当组件设置好大小后,调用final layout(int l, int

GridView设置分割线与dispatchDraw

自定义GridView : 在dispatchDraw中绘制分割线。 public class MyDividerGridView extends GridView {private Paint paint;public MyDividerGridView(Context context) {super(context);initPaint();}public MyDividerGridVie

draw与dispatchDraw

View类中的draw方法: public void draw(Canvas canvas) {final int privateFlags = mPrivateFlags;final boolean dirtyOpaque = (privateFlags & PFLAG_DIRTY_MASK) == PFLAG_DIRTY_OPAQUE &&(mAttachInfo == null || !m