I am trying to add Ripple Effect to RecyclerView's item. I had a look online, but could not find what I need. I have tried android:background attribute to the RecyclerView itself and set it to "?android:attr/selectableItemBackground" but it did not work.
My adapter template is like this
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:background="?android:attr/selectableItemBackground"
xmlns:custom="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:id="@+id/anLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:weightSum="4">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="3">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.kahoindia.dev.customclasses.KaHOTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
style="@style/kaho_listview_label_heading"
android:id="@+id/txtTitle"
custom:CustomTextViewFont="@string/kaho_segoeui_semi_light_font"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.kahoindia.dev.customclasses.KaHOTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:maxLines="2"
android:id="@+id/txtDetail"
style="@style/kaho_content_small_textview_style"
custom:CustomTextViewFont="@string/kaho_segoeui_regular_font"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="7dp"
android:layout_gravity="center"
android:gravity="right">
<com.kahoindia.dev.customclasses.KaHOTextView
android:id="@+id/txtDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/kaho_content_small_textview_style"
custom:CustomTextViewFont="@string/kaho_segoeui_regular_font"
/>
</LinearLayout>
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/progressBar"
android:indeterminate="true"
android:visibility="gone"
style="@android:style/Widget.Holo.ProgressBar"
android:layout_gravity="center_horizontal"/>
</LinearLayout>
</LinearLayout>
Please help me