Android 对recycleview触控事件没有连锁反应

Android 对recycleview触控事件没有连锁反应,android,android-recyclerview,ripple,Android,Android Recyclerview,Ripple,我已经使用RecycleView实现了导航抽屉,但是当我点击项目时,没有显示连锁反应。我的设备正在运行API 22 片段导航.xml: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"

我已经使用
RecycleView
实现了导航抽屉,但是当我点击项目时,没有显示连锁反应。我的设备正在运行API 22

片段导航.xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@android:color/white">


<RelativeLayout
        android:id="@+id/nav_header_container"
        android:layout_width="match_parent"
        android:layout_height="140dp"
        android:layout_alignParentTop="true"
        android:background="@color/colorPrimary">

    <ImageView
            android:layout_width="70dp"
            android:layout_height="70dp"
            android:src="@drawable/ic_profile"
            android:scaleType="fitCenter"
            android:layout_centerInParent="true" />

</RelativeLayout>


<android.support.v7.widget.RecyclerView
        android:id="@+id/drawerList"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/nav_header_container"
        android:layout_marginTop="15dp" />


        </RelativeLayout>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:clickable="true">
<ImageView android:layout_width="wrap_content"    android:layout_height="wrap_content"
           android:scaleType="fitCenter"
        android:src="@android:drawable/ic_input_get" android:id="@+id/imageView"/>
<TextView
        android:id="@+id/title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingLeft="30dp"
        android:paddingTop="10dp"
        android:text="asa"
        android:paddingBottom="10dp"
        android:textSize="15dp"
        android:textStyle="bold"
        android:layout_alignParentTop="true" android:layout_toRightOf="@+id/imageView"
        android:layout_toEndOf="@+id/imageView"/>

    </RelativeLayout>

我的行是:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@android:color/white">


<RelativeLayout
        android:id="@+id/nav_header_container"
        android:layout_width="match_parent"
        android:layout_height="140dp"
        android:layout_alignParentTop="true"
        android:background="@color/colorPrimary">

    <ImageView
            android:layout_width="70dp"
            android:layout_height="70dp"
            android:src="@drawable/ic_profile"
            android:scaleType="fitCenter"
            android:layout_centerInParent="true" />

</RelativeLayout>


<android.support.v7.widget.RecyclerView
        android:id="@+id/drawerList"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/nav_header_container"
        android:layout_marginTop="15dp" />


        </RelativeLayout>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:clickable="true">
<ImageView android:layout_width="wrap_content"    android:layout_height="wrap_content"
           android:scaleType="fitCenter"
        android:src="@android:drawable/ic_input_get" android:id="@+id/imageView"/>
<TextView
        android:id="@+id/title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingLeft="30dp"
        android:paddingTop="10dp"
        android:text="asa"
        android:paddingBottom="10dp"
        android:textSize="15dp"
        android:textStyle="bold"
        android:layout_alignParentTop="true" android:layout_toRightOf="@+id/imageView"
        android:layout_toEndOf="@+id/imageView"/>

    </RelativeLayout>


问题是什么?我如何解决这个问题?

尝试将此作为您的行布局

  <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="?android:attr/selectableItemBackground"
                android:focusable="true"
                android:clickable="true">

 <ImageView 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:scaleType="fitCenter"
    android:src="@android:drawable/ic_input_get"
    android:id="@+id/imageView"/>

 <TextView
            android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingLeft="30dp"
            android:paddingTop="10dp"
            android:text="asa"
            android:paddingBottom="10dp"
            android:textSize="15dp"
            android:textStyle="bold"
            android:layout_toRightOf="@+id/imageView"
            android:layout_alignParentTop="true"  
            android:layout_toEndOf="@+id/imageView"/>

        </RelativeLayout>


您的设备的API版本是什么?谢谢@PhanDinhThai,API 22那么您是否为布局/项目元素应用了材质主题?如果您确定使用的是Material主题或appCompat主题,但仍然不起作用,请尝试将此行添加到行布局的根中
android:background=“?android:selectableItemBackground”
当我单击项目时,没有选择效果,因此主题不是答案不确定为什么更多人不觉得这很有用,这真的节省了几个小时。很多人都在发布其他方式的selectableItemBackground,但这是唯一一个对我有效的方式!