Pav*_*kyy 5 android android-animation
我使用平移和旋转动画在事件中定位View内部。我希望动画能够立即执行,因此我将它们的持续时间都设置为0。但是,当应用程序启动时,屏幕的左上角会短暂闪烁一下,然后根据动画参数进行定位。如何避免这种眨眼?FrameLayoutonCreateView
小智 5
我整天都在解决这个问题。fillAfter和fillBefore与之无关。在动画开始之前尝试以下操作:
view.setVisibility(View.GONE); // view is our View we trying to animate
Run Code Online (Sandbox Code Playgroud)
然后为您的动画设置动画侦听器:
animation.setAnimationListener(new AnimationListener(){
public void onAnimationEnd(Animation animation) {
}
public void onAnimationRepeat(Animation animation) {
}
public void onAnimationStart(Animation animation) {
v.setVisibility(View.VISIBLE);
}
Run Code Online (Sandbox Code Playgroud)