Android Image View Animation leaving behind trail -
i animating imageview center of screen top-left using animation set.i translating , scaling view.
heres code snippet.
animationset tempanimation=new animationset(true); translateanimation anim = new translateanimation( 0,xpos, 0, ypos ); anim.setfillafter( true ); anim.setfillenabled(true); scaleanimation scaleanimation = new scaleanimation(1, (float)0.22, 1, (float)0.22, animation.relative_to_self, (float)0.5, animation.relative_to_self, (float)0.5); scaleanimation.setduration(1000); scaleanimation.setfillenabled(true); scaleanimation.setfillafter(true); tempanimation.addanimation(scaleanimation); tempanimation.addanimation(anim); tempanimation.setduration(1000); // takes care imageviews stay in final positions after animating . tempanimation.setfillenabled(true); tempanimation.setfillafter(true); mimageview.startanimation(tempanimation); so,the problem is leaving behind trail /previous positions brief moment.but doesnt or smooth.i have noticed if use 1 animation fine using animation set causes trail.are there tips avoid this?
cheers
found answer @ https://code.google.com/p/android/issues/detail?id=22151.
scale , translation animations have problem on android 2.3 .the simplest way fix add small transparent padding around image.in code shown above,just add
mimageview.setpadding(1,1,1,1); works charm!
Comments
Post a Comment