I have a LinearLayout
with a nested RecyclerView
showing a list of items. I'd like to open a popup when RecyclerView
is clicked (either one of the items or the background white area), but the usual setOnClickListener
is not working.
Of course I can put a click listener on each of the items, but the white area between them remains unclickable.
Is there a way to make the entire RecyclerView
area clickable?
EDIT: I've added some sample code. I'd like to have the entire layout clickable to open a popup, but while the first three views behave properly, the RecyclerView
does not.
<LinearLayout
android:id="@+id/layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="@dimen/spacing_half"
android:background="@color/color_item_margin_divider"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/fragment_tags_title"
style="@style/ItemFragmentHeader"/>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/spacing_line"
android:background="@color/color_line_divider"/>
<RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/spacing_half"/>
</LinearLayout>