@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 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); } }
private Transition buildEnterTransition() { Explode enterTransition = new Explode(); enterTransition.setDuration(getResources().getInteger(R.integer.anim_duration_long)); // 修饰动画,定义动画的变化率 enterTransition.setInterpolator(new AccelerateInterpolator()); return enterTransition; } }
private void initTransition() { Explode explode = new Explode(); explode.setDuration(1000L); getWindow().setEnterTransition(explode); explode.addListener(new Transition.TransitionListener() { @Override public void onTransitionStart(Transition transition) {
@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 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()); } });
@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(); }
private Transition buildEnterTransitionByCode() { Explode enterTransition = new Explode(); enterTransition.setDuration(500); return enterTransition; }
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void setupWindowAnimations() { Explode slideTransition = new Explode(); getWindow().setReenterTransition(slideTransition); getWindow().setExitTransition(slideTransition); }
private Explode buildMyExplodeInstance() { Explode explode = new Explode(); explode.setDuration(animDuration); return explode; }
private Transition buildEnterTransitionByCode() { Explode enterTransition = new Explode(); enterTransition.setDuration(500); return enterTransition; }
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public static Explode createExplode(long duration) { Explode explode = new Explode(); explode.setDuration(duration); return explode; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_content_transitions); initToolbar(); Slide slide=new Slide(); slide.setDuration(500); slide.setSlideEdge(Gravity.LEFT); getWindow().setEnterTransition(slide); getWindow().setReenterTransition(new Explode().setDuration(600)); }
private void setupWindowAnimation() { Explode explode = new Explode(); explode.setDuration(1000); Fade fade = new Fade(); fade.setDuration(500); getWindow().setReenterTransition(fade); getWindow().setExitTransition(explode); getWindow().setSharedElementExitTransition(new ChangeImageTransform()); getWindow().setSharedElementReenterTransition(new ChangeImageTransform()); }