如何将我的图像按钮以高程放置在我的 TextView 前面?

How do I place my ImageButton infront of my TextView with elevation?

我正在向我的应用程序添加一个对话框,我想将我的 exit/close ImageButton 放在我的 TextView 上,它具有带圆角和白色背景的自定义背景,但 ImageButton 始终位于 TextView 后面.

After Building In Design View

    <android.support.constraint.ConstraintLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/rounded_edittext">

    <TextView
            android:id="@+id/tCarparkName"
            android:layout_width="match_parent"
            android:layout_height="48dp"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:layout_marginStart="24dp"
            android:layout_marginTop="96dp"
            android:layout_marginEnd="24dp"
            android:background="@drawable/round_edittext"
            android:elevation="4dp"
            android:fontFamily="sans-serif-condensed"
            android:gravity="center"
            android:text="Parkhausname"      
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="1.0"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="@+id/a" />

    <ImageButton
            android:id="@+id/ibClose"
            style="@style/Widget.AppCompat.ImageButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/a"
            android:layout_alignParentEnd="true"
            android:layout_marginTop="107dp"
            android:layout_marginEnd="48dp"
            android:background="#00000000"
            android:cropToPadding="false"
            android:visibility="visible"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:srcCompat="@drawable/ic_close" />

</android.support.constraint.ConstraintLayout>

因为您正在 TextView 上设置 elevation。也尝试在您的 ImageButton 上设置 translationZelevation

android:translationZ="5dp"android:elevation="5dp"

android:高程="5dp"

这就是您的布局的高度