Android图像视图动画留下痕迹
我正在使用动画集从屏幕中心到左上角为ImageView设置动画。我正在平移和缩放视图 下面是代码片段Android图像视图动画留下痕迹,android,android-animation,Android,Android Animation,我正在使用动画集从屏幕中心到左上角为ImageView设置动画。我正在平移和缩放视图 下面是代码片段 AnimationSet tempAnimation=new AnimationSet(true); TranslateAnimation anim = new TranslateAnimation( 0,xPos, 0, yPos ); anim.setFillAfter( true ); anim.setFillEnabl
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);
// This takes care that the ImageViews stay in their final positions after animating .
tempAnimation.setFillEnabled(true);
tempAnimation.setFillAfter(true);
mimageView.startAnimation(tempAnimation);
所以,问题是,它会留下一个轨迹/之前的位置,只是一个短暂的瞬间。但它看起来不好或不平滑。我注意到,如果我只使用一个动画,它是好的,但使用动画集会导致轨迹。有没有避免这种情况的提示
“干杯”终于找到了答案 缩放和平移动画在Android 2.3上存在问题。解决此问题的最简单方法是在图像周围添加一个小的透明填充。在上面显示的代码中,只需添加
mimageView.setPadding(1,1,1,1);
工作起来很有魅力 嗨。。。您是否尝试减少设置持续时间(1000);设置持续时间(100);可能是因为这个原因,花不了多少时间。如果是解决方案,请尝试并回复我。感谢麻省理工学院,更改持续时间确实会让它看起来更好。不幸的是,我需要持续时间为1秒。我确实找到了解决方案。请检查下面。