0

I have a CardView that contains inside a LinearLayout with multiple views,I'd like to have a onClick to whole CardView but RecyclerView has its own and can't pass it to parent view. The layout:

<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/my_clickable_card"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:duplicateParentState="true"
    android:orientation="vertical">

    <TextView
        android:id="@+id/txt_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />


    <android.support.v7.widget.RecyclerView
        android:id="@+id/rv_items"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

</LinearLayout>

I tried android:clickable="false"andandroid:focusable="false" & android:duplicateParentState="true" for RecyclerView without success.

Any help is appreciated.

Hardik Vasani
  • 876
  • 1
  • 8
  • 14
Choletski
  • 7,074
  • 6
  • 43
  • 64

1 Answers1

0

you have to put cardview in the item layout so with no margins so it looks like the same and there will be no issues of scrolling Try to put it in the adapter layout.