第一种方法:
1.在调用 startActivity 或者 finish 后,
调用 overridePendingTransition(anim_enter, anim_exit);
2.在 Theme中复写掉系统默认的动画。
(1)写一个Theme,继承自原Activity使用的主题
@style/fade
@anim/alpha_enter
@anim/alpha_exit
@anim/alpha_enter
@anim/alpha_exit
(2)将该Theme设置到Activity中
android:name="com.xxxxxxxxx.ImagePreviewActivity"
android:screenOrientation="portrait"
android:theme="@style/Anim_fade"
android:windowSoftInputMode="stateAlwaysHidden|adjustResize"/>ps:第二种方法,在MIUI系统中退出Activity时不生效,具体原因未知。