z-index in Relative layout

后端 未结 5 796
情深已故
情深已故 2020-12-16 12:47

I need to place a TextView above the Button in RelativeLayout. But it is not working: TextView is always under the Button, even if I move it before the button. I also tried

5条回答
  •  一向
    一向 (楼主)
    2020-12-16 13:04

    You can't use a LinearLayout for this, but you can use a FrameLayout. In a FrameLayout, the z-index is defined by the order in which the items are added, for example:

    
    
    
    

    In this instance, the TextView would be drawn on top of the ImageView, along the bottom center of the image.

提交回复
热议问题