Pra*_*avy 7 animation android fragment android-animation
我使用fragmentTansaction.setCustomAnimation(in,out)为片段事务设置了自定义动画.我想知道动画的开始和结束并触发一些相应的动作.我怎样才能做到这一点?是否可以设置一些列表器?
您可以在 onStart() 中为 getDecorView() 使用动画
@Override
public void onStart() {
super.onStart();
if (getDialog().getWindow().getDecorView()) {
ObjectAnimator objectAnimator = ObjectAnimator.ofPropertyValuesHolder(getDialog().getWindow().getDecorView(),
PropertyValuesHolder.ofFloat(View.Y, 0, 1000));
objectAnimator.setDuration(1000);
objectAnimator.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
objectAnimator.start();
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
853 次 |
| 最近记录: |