@Override protected void onCreate(Bundle savedInstanceState) { // getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); super.onCreate(savedInstanceState); Slide slideIn = new Slide(); slideIn.setDuration(500); //设置为进入 slideIn.setMode(Visibility.MODE_IN); //设置从右边进入 slideIn.setSlideEdge(Gravity.RIGHT); getWindow().setEnterTransition(new ChangeImageTransform().setDuration(3000)); // getWindow().setEnterTransition(new Explode().setDuration(2000)); // getWindow().setExitTransition(new Explode().setDuration(2000)); Slide slideReturn =new Slide(); slideReturn.setDuration(500); slideReturn.setSlideEdge(Gravity.LEFT); slideReturn.setMode(Visibility.MODE_OUT); getWindow().setReturnTransition (slideReturn ); setContentView(R.layout.activity_img_transition); mImageView = (ImageView) findViewById(R.id.img); // Transition sharedElementEnterTransition = getWindow().getSharedElementEnterTransition(); }
private void setupCardFlipTransition() { CardFlipTransition flipIn = new CardFlipTransition(); flipIn.setDuration(500); flipIn.setMode(Visibility.MODE_IN); flipIn.addTarget(R.id.big_card); flipIn.excludeTarget(android.R.id.navigationBarBackground, true); flipIn.excludeTarget(android.R.id.statusBarBackground, true); getWindow().setEnterTransition(flipIn); CardFlipTransition flipOut = new CardFlipTransition(); flipOut.setMode(Visibility.MODE_OUT); flipOut.setDuration(500); flipOut.addTarget(R.id.big_card); flipOut.excludeTarget(android.R.id.navigationBarBackground, true); flipOut.excludeTarget(android.R.id.statusBarBackground, true); getWindow().setExitTransition(flipOut); }
private void setupCardFlipTransition() { CardFlipTransition flipOut = new CardFlipTransition(); flipOut.setDuration(500); flipOut.setMode(Visibility.MODE_OUT); flipOut.addTarget(R.id.text_card); flipOut.excludeTarget(android.R.id.navigationBarBackground, true); flipOut.excludeTarget(android.R.id.statusBarBackground, true); getWindow().setExitTransition(flipOut); CardFlipTransition flipIn = new CardFlipTransition(); flipIn.setDuration(500); flipIn.setMode(Visibility.MODE_IN); flipIn.addTarget(R.id.text_card); flipIn.excludeTarget(android.R.id.navigationBarBackground, true); flipIn.excludeTarget(android.R.id.statusBarBackground, true); getWindow().setEnterTransition(flipIn); }
private Visibility buildEnterTransition() { Fade enterTransition = new Fade(); enterTransition.setDuration(getResources().getInteger(R.integer.anim_duration_long)); // This view will not be affected by enter transition animation enterTransition.excludeTarget(R.id.square_red, true); return enterTransition; }
@TargetApi(Build.VERSION_CODES.LOLLIPOP) protected Visibility buildEnterTransition() { Slide enterTransition = new Slide(); enterTransition.setDuration(getResources().getInteger(R.integer.anim_duration_medium)); enterTransition.setSlideEdge(Gravity.RIGHT); //从右边滑动进入 return enterTransition; }
private Visibility buildEnterTransition() { Slide enterTransition = new Slide(); enterTransition.setDuration(getResources().getInteger(R.integer.anim_duration_long)); enterTransition.setSlideEdge(Gravity.RIGHT); return enterTransition; }
private void setupWindowAnimations() { Visibility enterTransition = buildEnterTransition(); getWindow().setEnterTransition(enterTransition); }
private Visibility buildReturnTransition() { Visibility enterTransition = new Slide(); enterTransition.setDuration(getResources().getInteger(R.integer.anim_duration_long)); return enterTransition; }