Android: how do i prevent canvas to draw the whole view when animation -


i hava customized view , draw ui on ondraw(canvas canvas) method. case need animation (anim true)

public class gameview extends view {  //more code  @override protected void ondraw(canvas canvas) {     canvas.drawbitmap(item.getbitmap(), item.getxy().getx(), item.getxy().gety(), null);     canvas.drawbitmap(resizedbitmapmapping.gethouse(), 0f, 0f, null);     if(amin){         canvas.save();         canvas.rotate(currentvalue);         drawball(canvas);         canvas.restore();     } } 

but ball small, small part of view needs re-drawn. should performance issue draw whole view. right draw such animation?

what looking canvas.cliprect().

here short video google explains how works , how use it. alternatively, can invalidate region of view view.invalidate(int,int,int,int).


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -