Android: Animation Position Resets After Complete

后端 未结 9 1541
南笙
南笙 2020-11-27 13:30

I\'m using an xml defined animation to slide a view off the screen. The problem is, as soon as the animation completes it resets to its original position. I need to know how

9条回答
  •  猫巷女王i
    2020-11-27 13:56

    I went to the same question and solved it with setting the marginLeft at OnAnimationEnd()..

    MarginLayoutParams params = (MarginLayoutParams) this.getLayoutParams(); params.setMargins(this.getWidth()*position, 0,0,0); this.setLayoutParams(params);

提交回复
热议问题