RelativeLayout 的最后一个 child 没有显示在其他 child 之上
RelativeLayout's Last child doesn't display on top of other child
这就是我想要实现的目标。
实际结果:
我的XML如下:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<Button
android:id="@+id/question_button"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerInParent="true"
android:textColor="@android:color/black"
android:background="@drawable/oval_button"
android:textSize="16sp"
android:gravity="center"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="20dp"
android:layout_height="20dp"
android:text="X"
android:gravity="center"
android:textColor="@android:color/white"
android:background="@drawable/oval_grid_wrong"
android:layout_alignParentRight="true"/>
</RelativeLayout>
如何将 X
TextView 置于最前面?
尝试删除 xml
中的按钮默认高度
<Button
...
android:stateListAnimator="@null"
....
/>
这就是我想要实现的目标。
实际结果:
我的XML如下:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<Button
android:id="@+id/question_button"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerInParent="true"
android:textColor="@android:color/black"
android:background="@drawable/oval_button"
android:textSize="16sp"
android:gravity="center"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="20dp"
android:layout_height="20dp"
android:text="X"
android:gravity="center"
android:textColor="@android:color/white"
android:background="@drawable/oval_grid_wrong"
android:layout_alignParentRight="true"/>
</RelativeLayout>
如何将 X
TextView 置于最前面?
尝试删除 xml
中的按钮默认高度<Button
...
android:stateListAnimator="@null"
....
/>