我不明白这个问题。我很确定我曾经这样做,但在这种情况下,不遵循zindex排序,下面的TextView隐藏在按钮后面:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:text="Button"
android:layout_width="match_parent"
android:layout_height="50dp" />
<TextView
android:textColor="@color/black"
android:text="TextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
我重新启动了Android Studio,但更糟糕的是,我的设备也是如此,所以它不是Android Studio的错误。这到底是什么问题?
如果向“相对布局”添加任何视图,如果不使用布局对齐方式(如layout_above / layout下面的/ layout_toleftof或右侧等),它会将视图放在另一个视图上方