@Nullable public Transition getExitTransition(@NonNull ViewGroup container, @Nullable View from, @Nullable View to, boolean isPush) { if (isPush) { return new Explode(); } else { return new Slide(Gravity.BOTTOM); } }
@Override @Nullable public Transition getEnterTransition(@NonNull ViewGroup container, @Nullable View from, @Nullable View to, boolean isPush) { if (isPush) { return new Slide(Gravity.BOTTOM); } else { return new Explode(); } }
@Override protected void onCreate(Bundle savedInstanceState) { // 设置一个exit transition if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); getWindow().setEnterTransition(new Explode()); getWindow().setExitTransition(new Explode()); } super.onCreate(savedInstanceState); setContentView(R.layout.activity_fragment); newFragment = new VideoFragment(); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.replace(R.id.frameLayout, newFragment); transaction.addToBackStack(null); transaction.commit(); }
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void setupWindowAnimations() { Explode slideTransition = new Explode(); getWindow().setReenterTransition(slideTransition); getWindow().setExitTransition(slideTransition); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.a_activity_three); Explode explode = new Explode(); explode.setDuration(500); getWindow().setExitTransition(explode); getWindow().setEnterTransition(explode); } }
@Override public void onClick(View view) { Explode explode = new Explode(); explode.setDuration(500); getWindow().setExitTransition(explode); getWindow().setEnterTransition(explode); ActivityOptionsCompat oc2 = ActivityOptionsCompat.makeSceneTransitionAnimation(AActivityOne.this); Intent i2 = new Intent(AActivityOne.this,AActivityThree.class); startActivity(i2, oc2.toBundle()); } });
private Transition buildEnterTransitionByCode() { Explode enterTransition = new Explode(); enterTransition.setDuration(500); return enterTransition; }
private Explode buildMyExplodeInstance() { Explode explode = new Explode(); explode.setDuration(animDuration); return explode; }
private Transition getTransition() { Transition transition = new Explode(); transition.setDuration(TimeUnit.SECONDS.toMillis(6)); return transition; }
private Transition buildEnterTransition() { Explode enterTransition = new Explode(); enterTransition.setDuration(getResources().getInteger(R.integer.anim_duration_long)); // 修饰动画,定义动画的变化率 enterTransition.setInterpolator(new AccelerateInterpolator()); return enterTransition; } }
@Override public void onClick(View view) { // Relaunch the activity with the transition information. Intent intent = new Intent(context,context.getClass()); intent.putExtra(TRANSITION_TYPE,"Explode"); getWindow().setExitTransition(new Explode()); startActivity(intent, ActivityOptions. makeSceneTransitionAnimation( (Activity)context).toBundle()); } });
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setEnterTransition(new Explode()); getWindow().setExitTransition(new Fade()); getWindow().setAllowEnterTransitionOverlap(true); }