1
我有一个警告对话框,我使用的条目的自定义动画:添加动画侦听一个警告对话框
dialog.getWindow().getAttributes().windowAnimations = R.style.my_animation;
<style name="my_animation">
<item name="android:windowEnterAnimation">@anim/slider_anim</item>
</style>
R.anim.slider_anim.xml
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromXDelta="-100%p"
android:fromYDelta="0"
android:duration=“1500">
</translate>
这工作得很好,但我想不出如何设置动画监听检测动画结束。我需要在对话框的动画完成后为另一个视图制作动画。
我试过,但动画没有加载在所有:
Animation animation = AnimationUtils.loadAnimation(root.getContext(), R.anim.slider_anim);
animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
Log.d(TAG, "onAnimationEnd");
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
dialog.getWindow().getDecorView().setAnimation(animation);
我怎样才能做到这一点?
如上所述,动画完全没有运行,第二个片段 – Jim