RelativeLayout的最后一个孩子不会显示在其他孩子的上方

问题描述 投票:0回答:1

这就是我想要实现的目标。

enter image description here

实际结果:

enter image description here

我的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带到前面?

android overlapping
1个回答
2
投票

尝试删除xml中的按钮默认高程

<Button
...
android:stateListAnimator="@null" 
....
/> 
© www.soinside.com 2019 - 2024. All rights reserved.