-1

I don't understand this issue. I'm pretty sure I used to do this, yet in this case, the zindex ordering is not followed, and the TextView below is hidden behind the button:

<?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

I have restarted Android Studio, but even worse, this is the same on my device too, so its not an Android Studio bug. What is the issue here exactly?

Zoe
  • 27,060
  • 21
  • 118
  • 148
breakline
  • 5,776
  • 8
  • 45
  • 84

2 Answers2

2

Please use the elevation

android:elevation="10dp"

here is you can see your solution

Tanveer Munir
  • 1,956
  • 1
  • 12
  • 27
0

If you add any views to Relative Layout, It places your view above another view if you don't use layout alignment like layout_above/layout_below/layout_leftof or rightof etc

SANDIP CHAUDHARI
  • 166
  • 1
  • 2
  • 5