1.关闭入场动画
1.1anim文件夹创建activity_in
<?xml version="1.0" encoding="utf-8"?><set xmlns:android="/apk/res/android"android:duration="0"><alphaandroid:duration="0"android:fromAlpha="0"android:toAlpha="1.0" /><translateandroid:fromXDelta="100%"android:toXDelta="100%" /></set>
1.2创建activity_out
<?xml version="1.0" encoding="utf-8"?><set android:duration="0" xmlns:android="/apk/res/android"><alphaandroid:duration="0"android:fromAlpha="1.0"android:toAlpha="0" /><translate android:fromXDelta="100%" android:toXDelta="100%"/></set>
1.3接着设置xml主题theme
<style name="NotTranslate" parent="Theme.AppCompat.Light.NoActionBar"><item name="windowActionBar">false</item><item name="windowNoTitle">true</item><item name="android:windowAnimationStyle">@style/Animation</item></style><style name="Animation"><item name="android:activityOpenEnterAnimation">@anim/activity_in</item><item name="android:activityOpenExitAnimation">@anim/activity_out</item><item name="android:activityCloseEnterAnimation">@anim/activity_in</item><item name="android:activityCloseExitAnimation">@anim/activity_out</item></style>
2.或者在activity代码中设置
val intent = Intent(this, SeatMapGoogleActivity::class.java)startActivity(intent)overridePendingTransition(0, 0)
3.xml设置关闭入场动画无效,需要在java代码中设置。在该activity设置,则该activity关闭无动画
override fun finish() {super.finish()overridePendingTransition(0, 0)}
如果觉得《android 关闭activity进场入场动画》对你有帮助,请点赞、收藏,并留下你的观点哦!