문제

I have two activities Main and Temp. I am calling Activity Temp and applying the following animation getActivity().overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);

to get that Temp activity from right to left. Now i want to finish that Activity Temp with reverse animation.. Is that possible?

도움이 되었습니까?

해결책 2

yes its possible by giving

overridePendingTransition(enterAnim, exitAnim);

When you start the temp activity call this meathod giving enter and exit animation for that particular activity. Then that activity will only finish with an animation. If thats not working you can also call the overridePendingTransition in the onFinish(); of temp activity. So that while finishing it will end up with the animation you give.

다른 팁

slide_in_left and slide_out_right exist in your default anim resources.

In your Main Activity, to open Temp (in your onClick):

finish();
Intent i2 = new Intent(Main.this, Temp.class);
startActivity(i2);
overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);

In your Temp activity:

@Override
public void onBackPressed() {
    finish();
    Intent i2 = new Intent(Temp.this, Main.class);
    startActivity(i2);
    overridePendingTransition(android.R.anim.slide_in_left,
                    android.R.anim.slide_out_right);
    super.onBackPressed();
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top