实际上,我可以使用 RotateAnimation
创建此设计,但是当我想更改它并应用任何动画时遇到问题。我们知道,Animation
不会改变View 的实际属性,它只对其进行动画处理。所以每次我遇到问题时,比如:
animation get back to its real state after finishing the animation and start every time from initial position.
所以为了避免这种情况,我想在 xml 中应用静态设计。我尝试使用 android:rotation
但没有按照确切的要求获得。
建议和帮助将是非常可观的。请提出建议。
最佳答案
我知道 android:fillAfter="true"
会导致很多问题!
另一种选择是您可以将动画监听器添加到动画中,并且在动画完成后,您手动设置 View 的最终转换。
yourAnimation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
/* Here, you could set them manually */
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
关于Android:如何在 xml 中创建床设计?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32708787/