我已经在API 19(4.2.2)上测试了一个小的布局,一切正常,但无法在API 21(5.0.1)上运行。
这是该布局:
<?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/start_button"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textStyle="bold"
android:textSize="30sp"
android:background="@color/start_button_bg"
android:textColor="@color/start_button_text"
android:text="@string/start_process"/>
<TextView
android:id="@+id/pro_icon"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:textColor="@android:color/white"
android:background="@drawable/pro_icon"
android:text="PRO"
android:gravity="center"
android:textAppearance="?android:attr/textAppearanceMedium"/>
</RelativeLayout>
非常简单的事情。我只想要在相对布局中,TextView覆盖在Button上面。我知道相对布局按照xml中添加的顺序堆叠视图,但是在棒棒糖上似乎不起作用。我无法让TextView渲染在按钮上方。有什么想法吗?
谢谢。