Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android ObjectAnimator fill after option?

In my android application I am using an ObjectAnimator to translate an imageview like so:

ObjectAnimator transitionX = ObjectAnimator.ofFloat(v, "TranslationY", 190);

Is there an option like fillAfter that will reset the position of the view to the new position, after the animation is complete?

like image 752
Eric Avatar asked Feb 12 '23 15:02

Eric


1 Answers

Nope, I'd use the property animation system instead, assuming v is a view:

v.animate().translationY(190).withEndAction(new Runnable() {
        @Override
        public void run() {
           v.setTranslationY(v.getTranslationY()-190);
        }
    }).start();
like image 161
roarster Avatar answered Feb 23 '23 08:02

roarster