Android : Canvas not update even I called invalidate()?

on Friday, October 10, 2014


I want to create a custom view that animates some lines. so I created a class that extends View class. I called onDraw() & drawn on the canvas. Here are some codes that I've approached so far.



@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
p += 10;
canvas.drawLine(5, 5, p, 5, mPaint);
invalidate();
}


note that p & mPaint are instantiated at the constructor.


but, even I called invalidate() method, it doesn't update the canvas, i.e. doesn't animate the line.


so, how to solve this?


0 comments:

Post a Comment