其实就是一个属性 overridePendingTransition()
overridePendingTransition(
int enterAnim,
int exitAnim)
-
Parameters:
- enterAnim A resource ID of the animation resource to use for the incoming activity. Use 0 for no animation.
- exitAnim A resource ID of the animation resource to use for the outgoing activity. Use 0 for no animation.
这个方法只能通过布局文件来实现 ,所以需要先写好布局文件
hold.xml
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator"
android:fromXDelta="0" android:toXDelta="0"
android:duration="@android:integer/config_longAnimTime" />