0

I tried the following code but it doesn't show any effect, I implemented the same method for recycler list view then it worked but for this, it is not working.

I want to make a round ripple and should fit card view.

Recycler view for card view:

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg"
android:orientation="vertical">

<android.support.v7.widget.RecyclerView
    android:id="@+id/rv_list"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:focusable="true"
    android:clickable="true"
    android:background="?android:attr/selectableItemBackground"/>

</LinearLayout>

CARD VIEW:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="180dp"
    android:gravity="center"
    android:orientation="vertical"
    android:focusable="true"
    android:clickable="true"
    android:background="?android:attr/selectableItemBackground">

    <android.support.v7.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center"
        card_view:cardBackgroundColor="@android:color/white"
        card_view:cardCornerRadius="8dp"
        card_view:cardElevation="3dp"
        card_view:cardUseCompatPadding="true">

      <!--some text and img views-->

        </LinearLayout>
    </android.support.v7.widget.CardView>
</LinearLayout>
Aarzu
  • 15
  • 5
  • Add the `clickable` , `focusable` and `background` attributes to the CardView and not the LinearLayout and the Recyclerview. – Shubham Panchal Jun 22 '19 at 07:43
  • @ShubhamPanchal by doing so neither click effect is showing nor intent for card view is working. :-( – Aarzu Jun 22 '19 at 09:07

0 Answers0