android - linear layout bringToFront()

前端 未结 4 599
走了就别回头了
走了就别回头了 2021-01-12 04:23

I have 4 buttons in my linear layout and i need to bring to front first button.

Normal order is

    Button 1 | Button 2 | Button 3 | Button 4
         


        
4条回答
  •  借酒劲吻你
    2021-01-12 05:12

    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).

提交回复
热议问题