9

I would like to know whether it is possible to change the z-order of a shared element transition? Look:

I have a layout with an image, that fills the whole screen. In front of the image is a textbox which shows the title of the image. If I klick on the textbox, the transition to the detail activity starts. Therefore I implemented a shared element transition, in which the fullscreen image animates to a smaller version of itself in the detail view. The picture below illustrates this behaviour.

enter image description here

My problem now is that in both activities are textboxes, that are placed above the shared element image. And if I went from overview to detail activity, I see the circle textbox with the number only after the shared element transition is finished. I would like to place the textbox with the number above the shared element transition, so that I could do an animation on this view element, too.

any idea on how to solve this?

jennymo
  • 1,450
  • 1
  • 18
  • 43
  • Did you ever come right with this? I believe I'm experiencing the same issue [over here](http://stackoverflow.com/questions/41461976/z-order-in-shared-element-activity-transition-animations) and I see you beat me to the post by more than a year... – Richard Le Mesurier Jan 10 '17 at 11:28
  • Unfortunately not :D – jennymo Jan 10 '17 at 13:17

2 Answers2

2

If I'm not mistaken, android calculates which views are on top of others by using the elevation of the views. Try playing around with the elevations (or the translationZ values) to decide which view(s) should be on top.

Matty De Bie
  • 111
  • 9
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient [reputation](http://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](http://stackoverflow.com/help/privileges/comment). - [From Review](/review/low-quality-posts/11031615) – gio Jan 26 '16 at 12:45
  • 1
    I wanted to comment on the question but as you state, I can't because of my reputation. He didn't provide any code, so if I had his problem, I would try the things I mentioned above. – Matty De Bie Jan 26 '16 at 15:24
0

Solution : ViewGroupTree

Solution

level 0 : MainConstraint  //(your row)
level 1 : ImageView / Otherlayout
level 2 : TextView

item A::BackgroundImage    : MainConstraint -> ImageView
item B::BackgroundTextView : MainConstraint -> Constraint -> TextView

With this, the layout are Z index order are messed up. because ImageView and TextView have different layout hierarchy, add your ImageView inside an other layout and it's will work as expected !! You have to use the same level of deep for each of your view to get a, expected call

I hope it's not late ;)