在android上清除setFillAfter()
我正在使用“平移动画”设置视图的动画。我使用了setFillAfter(true),它成功地设置了动画 我的密码是在android上清除setFillAfter(),android,Android,我正在使用“平移动画”设置视图的动画。我使用了setFillAfter(true),它成功地设置了动画 我的密码是 final ImageView image= (ImageView) findViewById(R.id.image2); image.setBackgroundResource(R.drawable.lamb); final Animation animation = AnimationUtils.loadAnimation(this, R.ani
final ImageView image= (ImageView) findViewById(R.id.image2);
image.setBackgroundResource(R.drawable.lamb);
final Animation animation = AnimationUtils.loadAnimation(this, R.anim.translate);
animation.setFillAfter(true);
image.startAnimation(animation);
animation.setAnimationListener(new AnimationListener()
{
public void onAnimationStart(Animation animation) { }
public void onAnimationRepeat(Animation animation) { }
public void onAnimationEnd(Animation animation)
{
Handler ss = new Handler();
ss.postDelayed(new Runnable()
{
public void run()
{
image.setVisibility(View.INVISIBLE);
}
} ,4000);
}
});
我使用一个处理程序在4秒后隐藏图像视图,但它不隐藏。一段时间后,我如何隐藏图像
动画结束后,我想在最后一个位置显示图像,因此我使用setFillAfter(true);4秒钟后,我隐藏了图像视图
如何使图像不可见?您需要设置AnimationListener。当动画结束时,使视图不可见
moveForward.setAnimationListener(new AnimationListener(){
@Override
public void onAnimationEnd(Animation animation) {
view.setVisibility(View.INVISIBLE);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationStart(Animation animation) {
}
});
image.clearaniamation(),在setVisibility(View.INVISIBLE)之前你把View.setVisibility(View.INVISIBLE)放在哪里了?对不起,小错误。。更新。。将AnimationListener设置为animation moveForward。。