Change DialogFragment enter/exit transition at just before dismissing

后端 未结 5 1856
别那么骄傲
别那么骄傲 2020-12-13 01:48

I have a DialogFragment and I set animation for enter/exit in the onActivityCreated method as below:

  @Override
    public void on         


        
5条回答
  •  攒了一身酷
    2020-12-13 02:44

    One simple way to do what you want is to use animation listeners like.

        animation.setAnimationListener(new AnimationListener() {
    
            @Override
            public void onAnimationStart(Animation animation) {
                // TODO Auto-generated method stub
            }
    
            @Override
            public void onAnimationRepeat(Animation animation) {
                // TODO Auto-generated method stub
    
            }
    
            @Override
            public void onAnimationEnd(Animation animation) {
                // TODO Auto-generated method stub
                // dismiss your dialog in here and it will work
            }
        });
    

    Start animation on your onclick method and dismiss dialog on onAnimationEnd() method.You may have to make snimation objects and start them manually with View's startAnimation(animation) method.

提交回复
热议问题