在Android中定义RelativeLayout视图的Z顺序 [英] Defining Z order of views of RelativeLayout in Android

查看:22
本文介绍了在Android中定义RelativeLayout视图的Z顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 Android 中定义一个 RelativeLayout 的视图的 z 顺序.

I would like to define the z order of the views of a RelativeLayout in Android.

我知道一种方法是调用 bringToFront.

I know one way of doing this is calling bringToFront.

有没有更好的方法来做到这一点?如果我可以在布局 xml 中定义 z 顺序就好了.

Is there are better way of doing this? It would be great if I could define the z order in the layout xml.

推荐答案

最简单的方法就是注意将视图添加到 XML 文件的顺序.在文件中较低意味着在 Z 轴上较高.

The easiest way is simply to pay attention to the order in which the Views are added to your XML file. Lower down in the file means higher up in the Z-axis.

这在此处此处.(感谢@flightplanner)

This is documented here and here on the Android developer site. (Thanks @flightplanner)

这篇关于在Android中定义RelativeLayout视图的Z顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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