重叠小工具

问题描述:

我在我的layout的同一个地方有多个小工具。其中3个是Buttons和1 TextView。我想要TextView以上的Buttons。我可以通过简单地在layout中切换Buttons的顺序来改变哪一个Button最重要。但是,TextView将永远不会在Buttons之上。重叠小工具

我成功地将TextView放在顶端的唯一方法是加入elevation,但由于我也针对API的21以下,因此无法按我的要求工作。任何想法如何解决我的问题?

+0

使用'里面LinearLayout' – Expiredmind

使用两LinearLayoutFrameLayout

<?xml version="1.0" encoding="utf-8"?> 
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 


    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

     <Button 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:text="OK" /> 

    </LinearLayout> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Text View" /> 
    </LinearLayout> 

</FrameLayout>