Android - ListView 内的水平 RecyclerView,执行 onitemClicListener

Android - Horizontal RecyclerView inside a ListView, Performing onitemClicListener

我在 ListView 中有一个水平的 RecyclerView,我需要从 Listview 捕获事件 onItemClickListener。我的目标是 API15,我也在我的设备中使用 Nougut 在模拟器上进行了测试 Android 版本 4.4.2。

以下代码是 Listview 的自定义布局。

<?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="match_parent"
    android:descendantFocusability="blocksDescendants"
    android:orientation="horizontal">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="10dp"
        android:background="@drawable/ic_prueba"
        android:gravity="center"
        android:id="@+id/tv_column_1"/>

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

</LinearLayout>

当应用程序在我的设备上运行时,列表视图中的 onItemClickListener 事件仅适用于文本视图。在回收站视图项目上,我无法获取列表视图事件。

这是列表视图中的模拟数据

RecyclerViews 可能正在吃事件。

在 Recyclerviews 中的各个视图上设置点击监听器。

此外,您可能应该使用 RecyclerView 而不是 ListView。