So I am trying to implement animations. Please assume that all the animations here is working as I have checked them one by one.
When an activity is new : Enter : Slide in From Right Exit : Slide out to Left
What I want to do now is, when user presses the back button the current activity will Slide Out to Right
and the activity that is called from backstack will Slide In From Left
I've overridden the onBackPressed
method and here is the code :
@Override
public void onBackPressed() {
super.onBackPressed();
overridePendingTransition(0, R.anim.slide_out_to_right);
}
I tried the onRestart method in the AppCompatActivity and overridePendingTransitions
but it is not working.
@Override
protected void onRestart() {
super.onRestart();
overridePendingTransition(R.anim.slide_in_from_left, 0);
}
The animation of the activity called from backstack is still Slide In From Right
which should be Slide In From Left
. Any ideas how I can fix this?
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.