共享元素过渡(前景/背景)问题 [英] Shared Element Transition (Foreground/Background) Issue

查看:181
本文介绍了共享元素过渡(前景/背景)问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以更改共享元素过渡的z顺序吗?看:

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.

< img src = https://i.stack.imgur.com/KPj0d.png alt =在此处输入图片描述>

我的问题现在,两个活动中都有文本框,它们位于共享元素图像上方。而且,如果我从概述活动转到详细活动,那么只有在共享元素转换完成后,我才能看到带有数字的圆圈文本框。
我想将文本框的数字放在共享元素过渡上方,这样我也可以在此view元素上制作动画。

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?

推荐答案

如果我没错,android通过使用视图的高程来计算哪些视图位于其他视图之上。尝试在高程(或translationZ值)上四处移动,以确定哪个视图应该在顶部。

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.

这篇关于共享元素过渡(前景/背景)问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆