2017-05-05 15 views
0

layoutの同じ場所に複数のウィジェットがあります。そのうちの3つはButtonsと1 TextViewです。ウィジェットのオーバーラップ

私はTextViewButtonsの上に置きたいと考えています。 layoutにあるButtonsの順番を単に変更することで、どれがButtonになるかを変更できます。ただし、TextViewは、Buttonsの上に決して上がることはありません。

私がTextViewを取得する唯一の方法は、elevationを追加することでしたが、21より下のAPIも対象にしていますので、それが欲しいとは思えません。どのように私の問題を解決することができますか?

+0

使用 '内部LinearLayoutのLinearLayout' – Expiredmind

答えて

1

2本使用FrameLayout

<?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> 
関連する問題