代码之家  ›  专栏  ›  技术社区  ›  breakline

Android Relativelayout Zindex不工作(不再工作)

  •  -1
  • breakline  · 技术社区  · 6 年前

    我不明白这个问题。我很确定我曾经这样做过,但是在这种情况下,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>
    

    enter image description here

    我重新启动了android studio,但更糟糕的是,我的设备上也一样,所以它不是android studio的bug。到底是什么问题?

    2 回复  |  直到 6 年前
        1
  •  1
  •   Tanveer Munir    6 年前

    请使用立面图

    android:elevation="10dp"
    

    这是你可以看到的 solution

        2
  •  0
  •   SANDIP CHAUDHARI    6 年前

    如果在相对布局中添加任何视图,如果不使用布局对齐方式(如布局上方/布局下方/布局左侧或右侧等),则将视图置于另一个视图上方。