【发布时间】:2017-01-10 22:27:55
【问题描述】:
几乎每篇关于分层小部件主题的文章都指向 FrameLayouts,它们应该根据 XML 中的出现顺序进行堆叠。为了测试,我在xml中放了一个按钮和一个TextView,希望看到TextView与按钮重叠。按钮放在textview之前还是之后都没有关系,按钮总是在顶部。谁能看到我做错了什么?
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.jdot.testloadingfragments.MainActivity">
<Button
android:id="@+id/btn_test"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text=" "
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="----------------------------------------------------------"/>
</FrameLayout>
【问题讨论】:
标签: android android-framelayout