2016-10-24 3 views
0

Ich animiere eine Ansicht, um den Bildschirm zu verlassen, auf komplett möchte ich eine andere Funktion aufrufen, aber ich kann nicht scheinen, eine OnComplete-Methode zu finden.gibt es eine TranslateAnimation onComplete?

int originalPos[] = new int[2]; 
       icons.getLocationOnScreen(originalPos); 
       layoutMoved = originalPos[0]+icons.getWidth(); 
       TranslateAnimation anim = new TranslateAnimation(0, -layoutMoved , 0, 0); 
       anim.setDuration(500); 
       anim.setFillAfter(true); 
       icons.startAnimation(anim); 
       icons.setVisibility(View.GONE); 

Antwort

3

Set ein AnimationListener, Sie haben Zugang zu OnAnimationEnd haben.

anim.setAnimationListener(new Animation.AnimationListener() { 
    @Override 
    public void onAnimationStart(Animation animation) { 

    } 

    @Override 
    public void onAnimationEnd(Animation animation) { 
     // do your stuff 
    } 

    @Override 
    public void onAnimationRepeat(Animation animation) { 

    } 
});