简体   繁体   中英

Slide out animation doesn't work (Android)

Check this post here. I did exactly the same and it works like a charm when I open a new Activity. But the problem is, when I'm going back to the previous activity, the animation doesn't work. It works only with the default navigationBar on the Bottom. I've an actionBar with an arrow and I want to animate when the user tap on the arrow and goes to the previous activity.

I tried to add programmatically the animation, but still it doesn't work. Even the finish() function doesn't work.

override fun onBackPressed() {
    super.onBackPressed()
    overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_right)
}

call finish() instead of super.onBackPressed()

override fun onBackPressed() {
    finish()
    overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_right)
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM