如何发送,以便回去?如何以编程方式控制Z顺序? [英] How to send view to back ? How to control the z-order programmatically?

查看:218
本文介绍了如何发送,以便回去?如何以编程方式控制Z顺序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题的看法发送到回。在Android中,我们有一个方法,像 bringToFront(),以放置视图上的另一种观点之上。这样,我想提出的观点在previous图像的下方。

I have a problem to send the view to back. In Android we have a method like bringToFront(), to place the view on top of the another view. Like that, I want to put the view on below the previous image.

有没有像 Android中sendToBack() bringToBack()任何方法。如果是这样,任何人可以帮助我在此。

Is there any method like sendToBack() or bringToBack() in Android. If so, can any one help me in this.

注:我不想控制Z顺序放置我想以编程方式控制Z顺序布局项目的顺序。

Note: that I do not want to control the z-order by the order of placing items in layout I want to control the z-order programmatically.

我不想隐藏我只是想他们是正在移动的观点背后的正面的看法。

I do not want to hide the views on the front I just want them to be behind the view that is moving.

推荐答案

AFAIK有这个没有内置的解决方案。我想你想修改z顺序在的FrameLayout,或者类似的东西。

Afaik there's no built-in solution for this. I guess you're trying to modify the z-order in a FrameLayout, or something similar.

不过,我想你可以修改布局所包含的子元素的顺序。 removeChild之...()和addView()方法可以采取位置值,这样你就可以围绕最可能的交换子元素,这将修改z顺序。这似乎有点哈克解决方案,但是。

However, I think you can modify the order of the contained child elements in the layout. RemoveChild...() and addView() methods can take position values, so you could most likely swap child elements around, and that would modify the z-order. It seems a bit hacky solution however.

或考虑修改子视图的可见性属性,您可能会收到类似的行为,这会是干净多了,我认为。

Or consider modifying the visibility property of the child views, you may get similar behaviour, and that'd be much cleaner I think.

编辑:

在新的Andr​​oid版本中,L开发preVIEW似乎终于,我们已经能够轻松地切换视图的Z轴顺序的能力。 高度和TranslationZ属性救援:<一href="https://developer.android.com/$p$pview/material/views-shadows.html">https://developer.android.com/$p$pview/material/views-shadows.html

With the new Android version, the L Developer Preview it seems that at last we have the ability to easily change the Z ordering of Views. 'Elevation' and 'TranslationZ' properties to the rescue: https://developer.android.com/preview/material/views-shadows.html

这篇关于如何发送,以便回去?如何以编程方式控制Z顺序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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