if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = getWindow(); Slide slide = new Slide(); slide.setInterpolator(new LinearInterpolator()); slide.setSlideEdge(Gravity.LEFT); slide.excludeTarget(android.R.id.statusBarBackground, true); slide.excludeTarget(android.R.id.navigationBarBackground, true); window.setExitTransition(slide); // The Transition to use to move Views out of the scene when calling a new Activity. window.setReenterTransition(slide); // The Transition to use to move Views into the scene when reentering from a previously-started Activity. window.setBackgroundDrawable(new ColorDrawable(Color.BLACK)); }
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = getWindow(); Slide slide = new Slide(); slide.setInterpolator(new LinearInterpolator()); slide.setSlideEdge(Gravity.RIGHT); slide.excludeTarget(android.R.id.statusBarBackground, true); slide.excludeTarget(android.R.id.navigationBarBackground, true); window.setEnterTransition(slide); // The Transition to use to move Views into the initial Scene. window.setReturnTransition(slide); // The Transition to use to move Views out of the Scene when the Window is preparing to close. window.setBackgroundDrawable(new ColorDrawable(Color.BLACK)); }
private void setupWindowAnimations() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Slide slideTransition = new Slide(); slideTransition.setSlideEdge(Gravity.LEFT); slideTransition.setInterpolator(new DecelerateInterpolator()); slideTransition.setDuration(460); Slide slideRightTransition = new Slide(); slideRightTransition.setSlideEdge(Gravity.RIGHT); slideRightTransition.setDuration(getResources().getInteger(R.integer.anim_duration_long)); getWindow().setReenterTransition(slideRightTransition); getWindow().setExitTransition(slideTransition); getWindow().setEnterTransition(slideTransition); getWindow().setSharedElementEnterTransition(new ChangeBounds().setDuration(450)); getWindow().setSharedElementReturnTransition(null); ViewCompat.setTransitionName(title, ab_title); ViewCompat.setTransitionName(menu1, fab_anim); } }