invalidate()
不记得我OnDraw()
方法。 我用invalidate()
中的setter方法在相同的类中OnDraw()
是英寸
public class PuzzleDraw extends View {
// defining some variables //
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
// codes for painting puzzle //
}
public PuzzleDraw(Context context) {
super(context);
}
// Method for giving cursor X/Y from MainActivity OnTouch() method and using it in OnDraw() method in some part of painting code //
public void setCursor(int i, int j) {
this.xx = i;
this.yy = j;
invalidate();
}
当我调试我的代码,一切都很好,除了忆及OnDraw()
时invalidate()
执行......其实, invalidate()
做什么我! 怎么了? 我用postInvalidate()
this.invalidate()
this.postInvalidate()
过,但什么都没有改变。