-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 stands with Ukraine
  • 25,310
  • 18
  • 114
  • 149
breakline
  • 5,431
  • 6
  • 42
  • 75

2 Answers2

2

Please use the elevation

android:elevation="10dp"

here is you can see your solution

Tanveer Munir
  • 1,852
  • 1
  • 11
  • 26
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