我有这样的FrameLayout:
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="changeColor"
android:text="new button"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="some text"/>
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)
问题是按钮显示在顶部,而FrameLayout类概述告诉我们:"子视图是在堆栈中绘制的,最近添加的子项位于顶部".