如何禁用MaterialCardView
的触摸纹波效应?将clickable
属性设置为false
或使用foreground
和background
属性没有影响。
我使用的是材料支持库版本1.1.0-alpha02.
发布于 2019-01-12 00:46:30
只有rippleColor
是styleable
<com.google.android.material.card.MaterialCardView
style="@style/Widget.MaterialComponents.CardView"
app:rippleColor="@android:color/transparent"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</com.google.android.material.card.MaterialCardView>
Note:不过,它并没有消除<androidx.cardview.widget.CardView
的连锁反应。
发布于 2021-10-28 12:43:04
只需在xml中使用此属性:
app:rippleColor="@android:color/transparent"
或者用Kotlin编程:
cardView.rippleColor = ColorStateList.valueOf(Color.TRANSPARENT)
发布于 2021-03-26 01:25:24
您可以这样使用CSS:
.mdc-card__primary-action.card__primary-action.mdc-ripple-upgraded {
&:hover,
&:focus,
&:active {
&.mdc-card__primary-action::before,
&.mdc-card__primary-action::after {
background-color: rgba(255, 255, 255, 0) !important;
opacity: 0 !important;
}
}
}
https://stackoverflow.com/questions/54136501
复制相似问题