android - ScaleAnimation in custom View getting clipped -


i have custom view implement ondraw , draws background small overlay image @ top right. animate overlay image (animationset scaleanimation , rotate animation) manually doing:

final animationset animationset = new animationset(false); animationset.addanimation(scaleanimation); animationset.addanimation(rotationanimation); animationset.setfillafter(true); post(new runnable() {     @override     public void run () {         animationset.start();         new handler().post(getanimationrunnable(animationset));     }      private runnable getanimationrunnable (final animationset animationset) {         return new runnable() {             @override             public void run () {                 final transformation outtransformation = new transformation();                 if (animationset.gettransformation(system.currenttimemillis(), outtransformation)) {                     // store matrix applying in ondraw                     mmatrix = outtransformation.getmatrix();                     // invalidate doesn't work                     parent.invalidate(new rect(getparentinvalidaterect()));                     post(getanimationrunnable(animationset));                 }             }         };     } }); 

if invalidate custom view ...

                    // invalidate work                     invalidate(getoverlayclientrect()); 

then animation happens , great, except animated image gets clipped - because it's being scaled up, beyond top , right bounds.

but when pass rect parent.invalidate() intersects custom view's top right corner area, not trigger ondraw custom view.

so ...

  • will approach work?
  • if so, there other factor rect passed parent.invalidate() determines whether call custom views ondraw method?

after lot of searching, answer obvious. had set clipchildren property of parent false. didn't need invalidate parent, custom view.

that worked fine on 4.0.3 tablet. however, on galaxy nexus (4.2.2), not did render outside of bounds during animation, cleared background of rect passed invalidate. so, when animation done remnants of image still visible outside rect. solution there pass rect large enough cover largest of drawn bitmaps during animation.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -