平时使用CardView默认是带有阴影效果的,如果不想要阴影效果,只需要将以下属性设置为0即可:
app:cardElevation="0dp"
app:cardMaxElevation="0dp"
<androidx.cardview.widget.CardView
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="188dp"
android:background="@color/transparent"
android:foreground="?android:attr/selectableItemBackground"
app:cardCornerRadius="12dp"
app:cardElevation="0dp"
app:cardMaxElevation="0dp">
</androidx.cardview.widget.CardView>

本文介绍了如何在Android中消除CardView的阴影效果,只需将`app:cardElevation`和`app:cardMaxElevation`属性设置为0dp,即可实现无阴影的CardView效果。

被折叠的 条评论
为什么被折叠?



