重叠小工具
问题描述:
我在我的layout
的同一个地方有多个小工具。其中3个是Buttons
和1 TextView
。我想要TextView
以上的Buttons
。我可以通过简单地在layout
中切换Buttons
的顺序来改变哪一个Button
最重要。但是,TextView
将永远不会在Buttons
之上。重叠小工具
我成功地将TextView
放在顶端的唯一方法是加入elevation
,但由于我也针对API的21以下,因此无法按我的要求工作。任何想法如何解决我的问题?
答
使用两LinearLayout
个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>
使用'里面LinearLayout' – Expiredmind