当前位置:网站首页>Activity enter exit animation

Activity enter exit animation

2022-07-05 10:16:00 asahi_ xin

1. translation

activity_next_enter

<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="300"
    android:fromXDelta="100%p"
    android:toXDelta="0">
</translate>

activity_next_exit

<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="300"
    android:fromXDelta="0"
    android:toXDelta="-100%p">
</translate>

activity_up_enter

<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="300"
    android:fromXDelta="-100%p"
    android:toXDelta="0">
</translate>

activity_up_exit

<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="300"
    android:fromXDelta="0"
    android:toXDelta="100%p">
</translate>

Call in

 ...
 overridePendingTransition(R.anim.activity_next_enter, R.anim.activity_next_exit);
 super.onCreate(savedInstanceState);

Call exit

  finish();
  overridePendingTransition(R.anim.activity_up_enter, R.anim.activity_up_exit);
原网站

版权声明
本文为[asahi_ xin]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202140534181633.html