我有 2 个视图通过同时滑入和滑出屏幕进行动画处理
这是它的代码:How to Animation a slide in notification view that push the content view down
但是,当动画滑入时,我必须清除动画,以便点击事件正常工作,否则它们也会被翻译(这不是我想要的)
我需要在侦听器中放入 onAnimationEnd 什么才能清除动画并使视图保持动画后的外观
这是我当前的代码:
greenViewSlideIn(1500, 0, new AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
greenView.setVisibility(View.VISIBLE);
}
@Override
public void onAnimationRepeat(Animator animation) {
// TODO Auto-generated method stub
}
@Override
public void onAnimationEnd(Animator animation) {
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(blueView.getWidth(), blueView.getHeight());
layoutParams.setMargins(blueView.getLeft(), blueView.getTop() - greenViewHeight, blueView.getRight(), blueView.getBottom());
blueView.setLayoutParams(layoutParams);
greenView.clearAnimation();
// blueView.clearAnimation();
}
@Override
public void onAnimationCancel(Animator animation) {
// TODO Auto-generated method stub
}
});