结束动画事件的android [英] End animation event android

查看:112
本文介绍了结束动画事件的android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我显示淡出的动画中的图(其是片段内),并每次动画发生,之后它完成的视图再次重绘自身。我发现周围的工作做 view.SetVisibility(View.GONE)。不过,这并不等待动画完成。我想只执行后,动画已经完成了这个setVisibility code。什么是做到这一点的最好方法是什么?

I have a fadeout animation in a view (which is inside a fragment), and everytime the animation happens, after it finishes the view redraws itself again. I found a work around doing view.SetVisibility(View.GONE) . But it doesn't wait for the animation to finish. I would like to execute this setVisibility code only after the animation has finished. What is the best way to do that?

推荐答案

您可以添加动画监听到你的动画对象像

You can add Animation listener to your animation object like

anim.setAnimationListener(new Animation.AnimationListener(){
    @Override
    public void onAnimationStart(Animation arg0) {
    }           
    @Override
    public void onAnimationRepeat(Animation arg0) {
    }           
    @Override
    public void onAnimationEnd(Animation arg0) {
    }
});

这篇关于结束动画事件的android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆