Cards dont show visual feedback

257 views Asked by At

I have a recycler adapter full of cards. The cards themselves work fine. However when i click the card it does not show any visual feedback its being clicked. Is there something im missing? I also would appreciate a tutorial on mateial design animation. The android developer site didnt really break things down.

Im looking for this effect https://www.google.com/design/spec/animation/responsive-interaction.html#responsive-interaction-user-input

<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:clickable="true"
android:background="?android:attr/selectableItemBackground"
card_view:cardCornerRadius="2dp"
card_view:cardElevation="4dp"
android:layout_margin="5dp">

<RelativeLayout
    android:id="@+id/cardBackground"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/colorPrimary">

    <TextView
        android:id="@+id/cardname"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:textColor="@color/white"
        android:gravity="center_horizontal"
        android:textStyle="bold"
        android:textSize="35sp"/>

    <TextView
        android:id="@+id/cardtime"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/cardname"
        android:textColor="@color/white"
        android:gravity="center_horizontal"
        android:textStyle="bold"
        android:textSize="15sp"/>

</RelativeLayout>

1

There are 1 answers

0
Adrian Le Roy Devezin On BEST ANSWER

I was able to achieve visual feedback by changing

android:background="?android:attr/selectableItemBackgroundBorderless"

To

android:foreground="?android:attr/selectableItemBackgroundBorderless"

In the cardview