gpt4 book ai didi

android - 动画后更新布局

转载 作者:行者123 更新时间:2023-11-30 03:40:31 26 4
gpt4 key购买 nike

我使用动画展开 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com