Shared Element Transition (Foreground/Background) Issue
Asked Answered
G

2

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?

Gestapo answered 2/9, 2015 at 8:19 Comment(2)
Did you ever come right with this? I believe I'm experiencing the same issue over here and I see you beat me to the post by more than a year...Chassidychassin
Unfortunately not :DGestapo
T
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.

Thong answered 26/1, 2016 at 11:55 Comment(2)
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 you will be able to comment on any post. - From ReviewNatatorium
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.Thong
E
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 ;)

Enid answered 11/6, 2019 at 18:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.