【发布时间】:2019-01-14 13:35:21
【问题描述】:
我正在向我的应用程序添加一个对话框,我想将我的退出/关闭 ImageButton 放在我的 TextView 上,该 TextView 具有圆角和白色背景的自定义背景,但 ImageButton 一直停留在 TextView 后面。
<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>
【问题讨论】:
-
你能直观地解释一下吗?你想要达到的目标
-
检查我上传的图片以获得更好的理解。
-
也提供您的完整布局文件...
-
我添加了我的布局谢谢!
-
第一张图片是您的预期输出吗?
标签: android xml textview imagebutton