0

Is there a way to make a ripple have a darkening effect instead of lightening one?

I can set the background of a CardView to a darker color and clearly see the ripple feedback. However, my card normally has a white background. The ripple is almost invisible because it is only noticeable on top of dark text within the card.

BackgroundTint (a common response) is api 21+.

Build

compileSdkVersion 23
minSdkVersion 16
targetSdkVersion 23


compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:cardview-v7:23.1.+'

XML

<android.support.v7.widget.CardView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    android:id="@+id/my_card"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    card_view:cardBackgroundColor="@color/colorGrayDark"
    android:foreground="?android:attr/selectableItemBackground"
    card_view:cardCornerRadius="2dp"
    card_view:cardElevation="2dp"
    card_view:cardPreventCornerOverlap="false"
    card_view:cardUseCompatPadding="true">
        ...
</android.support.v7.widget.CardView>
nograde
  • 2,268
  • 5
  • 22
  • 29

0 Answers0