我有一个简单的ImageView
,是我作为矢量资源导入的垃圾桶。以下是XML代码:
<ImageView
android:id="@+id/trashcan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="8dp"
android:elevation="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/ABtn"
app:layout_constraintTop_toTopOf="parent"
android:background="@drawable/ic_trashcan" />
为什么即使存在高度差,阴影也不显示?我想避免使用
cardview
容器并使用其阴影,否则我将不得不为任何类型的ImageView
封装一个cardView
以实现该功能。上述ImageView
的父级是ConstraintLayout
。