Home > database >  Activity transition shared animation background bug
Activity transition shared animation background bug

Time:01-25

I have a bug when using transition between activities by using a shared element.

  1. I'm using sample ActivitySceneTransitionBasic .

  2. Add delay before navigation.

new Handler().postDelayed(() -> {
          ActivityCompat.startActivity(MainActivity.this, intent, activityOptions.toBundle());
    }, 2000);
  1. Turn screen off.

There is no bug if activity open without turn screen off.

The New Activity opens without background (like on screenshot) or with glitches. Can you help to solve this bug?

CodePudding user response:

try increasing the delay time to 5000

 new Handler().postDelayed(() -> {
      ActivityCompat.startActivity(MainActivity.this, intent, 
 activityOptions.toBundle());
  }, 5000);

or try to delay the turning off of the screen until after the transition is complete by using setExitSharedElementCallback() method to set a callback that is triggered when the shared element transition is finished, and use this callback to turn off the screen.

CodePudding user response:

If you are using basic ActivityTransition scene I hope this will help.

  • Related