something weird is happening to me. I have this layout:
<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/gray_dark" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:drawableTop="@drawable/some_drawable"
android:text="Some text" />
</RelativeLayout>
And I would expect that TextView is visible above button. But for some reason the Button goes to front automaticaly, covering up the textview. When I change Button to common View, the order is right.
Is there something I am missing about Buttons in Android? Thanks
Edit:
Preview:
I just tried the same thing and the weird thing is, it also happend to me. I fixed it like this
<?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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FF0000"
android:text="lalala"/>
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#FFFF00"
android:text="lalala"/>
</RelativeLayout>