Following code works for enter animation and exit animation as well, i do not want it to animate on exit. What am i doing wrong here. ?
MyProfileFragment profileFragment = new MyProfileFragment();
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.replace(R.id.content_frame, profileFragment);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
profileFragment.setEnterTransition(new Fade().setDuration(200));
//profileFragment.setExitTransition(new Fade().setDuration(0));
}
ft.addToBackStack("profile");
ft.commit();
By default, the value passed into
Fragment.setEnterTransition
is reversed when that Fragment exits. To avoid this, you can assignnull
or another value toFragment.setExitTransition
.