【发布时间】:2021-10-04 09:44:10
【问题描述】:
我正在尝试将小图像视图重叠在大图像视图上。我已经在模拟器和真实设备中测试了这段代码。没有任何效果。 XML代码sn-p:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/itemCard"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- large ImageView -->
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/imageViewPhoto"
android:layout_width="match_parent"
android:layout_height="@dimen/_145sdp"
android:background="@color/grey_lighter"
android:elevation="@dimen/_1sdp"
android:scaleType="centerCrop"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.App.CornerSize50Percent"
app:srcCompat="@mipmap/dummy" />
<!-- small ImageView -->
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/typ_rounded_view"
android:paddingStart="@dimen/_8sdp"
android:paddingTop="@dimen/_3sdp"
android:paddingEnd="@dimen/_4sdp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:srcCompat="@drawable/ic_video" />
</androidx.constraintlayout.widget.ConstraintLayout>
约束布局分级:
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
Android Studio 版本:4.2.2
【问题讨论】:
-
你能分享一下你想要如何重叠的预览吗?
-
@Bhavin 请检查附件中的预览。
标签: android android-layout android-imageview android-constraintlayout