android - 动画后更新布局

标签 android android-layout animation android-relativelayout

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

相关文章:

android - intent.setType(type) 可能的 Intent 类型是什么?

android - 用于平板电脑设备中数字的 EditText 输入类型,始终显示额外的键

c# - 使用 Canvas 模板的 ItemsControl 内的椭圆移动动画

javascript - Chart.js 饼图动画,当通过垂直滚动在页面中的某个位置时播放一次

python - 在 PyQT4 GUI 中嵌入的 funcAnimation 中使用 blitting

php - MySql数据库设计,支持Android App

android - 在android studio中隐藏logcat左侧菜单

android - 动画 : Move TextView into another container

android - 如何在 okhttp 库的 header 中发送特殊字符,如 å

java - Android .setViewPager 返回 NullPointerException