7

I am doing some basic shared element activity transition animations with code similar to this:

Intent i = new Intent(AnActivity.this, AnotherActivity.class);
ActivityOptionsCompat options =
        ActivityOptionsCompat.makeSceneTransitionAnimation(this,
                Pair.create(vBackground, "background"),
                Pair.create(vImage, "image"),
                Pair.create(vName, "name"),
                Pair.create(vDistance, "distance")
        );
startActivity(i, options.toBundle());

Can I change the Z-order that the animation assigns to the views?

The reason is that some of the views are hidden by the others during the animation, even though in both activity layouts this is not the case. Somewhere in the transition code, the Z-order of the views gets changed.

I have tried reordering the Pair.create(...) lines, but to no great success.

Richard Le Mesurier
  • 29,432
  • 22
  • 140
  • 255
  • Related: [Shared Element Transition (Foreground/Background) Issue](http://stackoverflow.com/questions/32348018/shared-element-transition-foreground-background-issue) (but can't close as duplicate as no accepted answer there) – Richard Le Mesurier Jan 10 '17 at 11:26
  • Solution : ViewGroupTree # Solution level 0 : Activity_layout level 2 : Fragment_layout item 1::Hierarchy : Constraint -> vImage item 1::Hierarchy : Constraint -> Constraint -> Linear -> Background With this, the layout are Z index order are messed up. You have to use the same level of deep for each of your view to get a, expected call – Pierre-Emmanuel Mercier Jun 11 '19 at 18:32

0 Answers0