My RecyclerView:
<android.support.v7.widget.RecyclerView
android:background="?android:selectableItemBackground"
app:layoutManager="android.support.v7.widget.LinearLayoutManager"
android:id="@+id/crash_course_item_dates"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:clickable="true"
/>
ClickListener:
holder.crashCoursesDateRecyclerView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
crashCourseListener.onCrashCourseClick(crashCourse);
}
});
However it's not working when I click on the recyclerview. I thought it might be that the clicklistener is being triggered by the items inside the recyclerview. So what I tried is setting clickable=false in the recyclerview Items' layout and settings the layout's onClickListener(null) but it't not working.
update
Thanks for all your answers, I should have explained better, i have a recyclerview inside another recyclerview item, each item of the latter has a recyclerview inside. I fixed this problem by putting the recyclerview in a frame layout and adding another layout 'on top' of the recyclervjew and setting the onClickListener on that layout.