4

Is it possible to combine ActivityOptionsCompat.makeCustomAnimation() and ActivityOptionsCompat.makeSceneTransitionAnimation() ? I want to acheive the following Activity change effect:

  1. One view stays on the screen
  2. Other views from old activity slide out
  3. Views from the new activity fade in

I can use points 1 and 2, 3 separately, is there a way to use them simultaneously maybe using different method or something?

N J
  • 27,217
  • 13
  • 76
  • 96
MightySeal
  • 2,293
  • 2
  • 17
  • 32

1 Answers1

5

The ActivityOptionsCompat.makeSceneTransitionAnimation() should do all of what you want in L+. In your calling Activity's style add:

<item name="android:windowExitTransition">@android:transition/slide_right</item>

and in your called Activity's style add:

<item name="android:windowEnterTransition">@android:transition/fade</item>
<item name="android:windowSharedElementEnterTransition">@android:transition/move</item>

You may want to do this as well:

How do I prevent the status bar and navigation bar from animating during an activity scene animation transition?

Community
  • 1
  • 1
George Mount
  • 20,708
  • 2
  • 73
  • 61