Try to Understand the View order(Hierarchy)
let me make it clear with an example
<?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="match_parent"
>
<TextView
android:id="@+id/tvMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="dasdjfiuihuhds" />
<Button
android:id="@+id/btnOk"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Ok" />
</RelativeLayout>
This will make Textview over ButtonView
<?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="match_parent"
>
<Button
android:id="@+id/btnOk"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Ok" />
<TextView
android:id="@+id/tvMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="dasdjfiuihuhds" />
</RelativeLayout>
This will make Button over TextView
1st case code
<RelativeLayout >
<TextView>
<Button>
2nd case code
<RelativeLayout >
<Button>
<TextView>
in Short you can maintain order by following code hierarchy
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…