我使用动画展开 ImageView,但在缩放后它与其他 View 重叠。有什么方法可以更新布局属性,我在 Activity xml 文件中定义? IE。我有一些属性,例如 layout_toRightOf
,我想在动画之后应用。
这是我的代码:
动画:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true"
android:fillEnabled="true">
<scale
android:duration="500"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="2.0"
android:toYScale="2.0" />
</set>
应用动画:
Animation shrinkAnimation = AnimationUtils.loadAnimation(MainActivity.this, R.anim.shrink_animation);
someView.startAnimation(shrinkAnimation);
最佳答案
shrinkAnimation.setAnimationListener(new Animation.AnimationListener(){
@Override
public void onAnimationStart(Animation arg0) {
}
@Override
public void onAnimationRepeat(Animation arg0) {
}
@Override
public void onAnimationEnd(Animation arg0) {
// Update your View here...
}
});
关于android - 动画后更新布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15817164/