onAnimationEnd is not getting called, onAnimationStart works fine

后端 未结 14 1700
情书的邮戳
情书的邮戳 2020-12-23 19:51

I\'ve a ScrollView in the PopupWindow. I\'m animating ScrollView contents using TranslateAnimation.

When animation starts, the onAnimationStart listener is called bu

14条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-23 20:24

    Do it like belows

    1. make animation final
    2. invoke it inside a handler
    3. listener should be instantiated once.
    4. clear animation.

    for example view.clearAnimation();

    new Hander().post(
       run() {
    final TranslateAnimation ani = new TranslateAnimation(0, 0, 0, 0);
    ani.setAnimationListener(mListener);
     }
    );
    
    private Animation.AnimationListener mListener = new Animation.AnimationListener() {
    }
    

提交回复
热议问题