机器人 - 线性布局bringToFront() [英] android - linear layout bringToFront()
问题描述
我在我的线性布局4个按钮,我需要提请前面第一个按钮。
I have 4 buttons in my linear layout and i need to bring to front first button.
正常秩序为
Button 1 | Button 2 | Button 3 | Button 4
但是,当我打电话button1.bringToFront()函数,按钮1将最终像
But when i call button1.bringToFront() function , button1 is going to end like
Button 2 | Button 3 | Button 4 | Button 1
我怎样才能解决这个问题。相对布局不导致此问题,但我必须使用的LinearLayout,因为按钮将责令垂直和我删除按钮,在一定的条件。
How can i solve this problem. Relative layout doesn't causes this problem but i have to use LinearLayout because buttons will order vertically and i am deleting a button in some conditions.
感谢
推荐答案
的LinearLayout
不与z轴工作,因此,它的名字线性
。尝试使用 RelativeLayout的
,然后调用 bringToFront()
以获得预期的效果。随着 RelativeLayout的
您可以致电 layout_alignBollow
垂直命令的意见。或者你可以嵌套的看法和布局,例如,你的的LinearLayout
窝在三 RelativeLayout的
中那些你可以把你的按钮
(注意用这种方法,因为加入过多的意见,可以是一件坏事)。
LinearLayout
doesn't work with the z-axis, hence, it's name linear
. Try using a RelativeLayout
and then call bringToFront()
to get the desired effect. With a RelativeLayout
you can call layout_alignBollow
to order the views vertically. Or you can nest views and layouts, for instance, within your LinearLayout
nest three RelativeLayout
within those you can place your Buttons
(be careful with this approach as adding too many views can be a bad thing).
这篇关于机器人 - 线性布局bringToFront()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!