Android TranslateAnimation resets after animation

后端 未结 6 1359
灰色年华
灰色年华 2020-12-02 10:13

I\'m creating something like a SlideDrawer but with most customization, basically the thing is working but the animation is flickering at the end.

To further explain

6条回答
  •  心在旅途
    2020-12-02 10:43

    From API 11, you can use the ObjectAnimator, which actually changes the view properties, i.e. in the case of a translation, the view will remain at the position it reaches after the animation.

    ObjectAnimator objectAnimator= ObjectAnimator.ofFloat(mContent_container, "translationX", startX, endX);
    objectAnimator.setDuration(1000);
    objectAnimator.start();
    

    More here.

提交回复
热议问题