จะลบเอฟเฟกต์ระลอกคลื่นออกจาก MaterialCardVew ได้อย่างไร

ฉันจะปิดการใช้งานเอฟเฟกต์ระลอกคลื่นสัมผัสของ MaterialCardView ได้อย่างไร การตั้งค่าแอตทริบิวต์ clickable เป็น false หรือการเล่นกับแอตทริบิวต์ foreground และ background ไม่มีผลใดๆ

ฉันกำลังใช้ไลบรารีการสนับสนุนวัสดุเวอร์ชัน 1.1.0-alpha02


person Mahozad    schedule 10.01.2019    source แหล่งที่มา
comment
ไม่มี ripples สำหรับ MaterialCardView ที่เป็นไปได้   -  person Martin Zeitler    schedule 11.01.2019
comment
@MartinZeitler คำถามนี้ตรงกันข้าม! ฉันได้ถามวิธีลบเอฟเฟกต์ระลอกคลื่น   -  person Mahozad    schedule 11.01.2019


คำตอบ (2)


เฉพาะ 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>
person Martin Zeitler    schedule 12.01.2019
comment
ใน MaterialCardView ไม่มีแอตทริบิวต์ rippleColor แล้วจะกำจัดยังไงล่ะ? คุณช่วยอธิบายได้ไหม? - person vikas singh; 19.04.2019
comment
@vikassingh มีครับ บางทีการพึ่งพาของคุณอาจเก่าไปแล้ว? ลอง 1.1.0-beta07 - person behelit; 01.06.2019

คุณสามารถทำได้โดยใช้ 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;
    }
  }
}
person Manager DMT    schedule 26.03.2021
comment
คำถามนี้เกี่ยวกับ Android - person David; 08.06.2021