Reputation: 23
Here is my main xml file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/view"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
android:id="@+id/tool_bar"
layout="@layout/tool_bar"></include>
<android.support.v4.widget.DrawerLayout
android:layout_below="@+id/tool_bar"
android:id="@+id/DrawerLayout"
android:elevation="7sp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tool_bar"
android:text="@string/hello_world" />
<android.support.v7.widget.RecyclerView
android:id="@+id/RecycleView"
android:layout_width="288dp"
android:background="#ffffff"
android:layout_height="match_parent"
android:layout_gravity="left"
android:scrollbars="vertical"
android:focusable="true"
android:clickable="true">
</android.support.v7.widget.RecyclerView>
</android.support.v4.widget.DrawerLayout>
</RelativeLayout>
Here is my item_row.xml file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:layout_height="wrap_content"
android:background="#ffffff"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/rowIcon"
android:paddingLeft="16dp"
android:src="@drawable/ic_launcher"/>
<com.balysv.materialripple.MaterialRippleLayout
android:id="@+id/ripple"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="12dp"
android:paddingTop="4dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Medium Text"
android:id="@+id/rowText" />
</com.balysv.materialripple.MaterialRippleLayout>
</LinearLayout>
I am using the libray https://github.com/balysv/material-ripple
When I am not using the library the click is working fine but when using the library I did not receive any touch feedback.
Please help me on this.
Upvotes: 0
Views: 533
Reputation: 1493
Try to wrap your item_row.xml with the MaterialRippleLayout. Basically set it as your parent layout to receive the click from the user. Try this:
<?xml version="1.0" encoding="utf-8"?>
<com.balysv.materialripple.MaterialRippleLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/ripple"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:background="#ffffff"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:mrl_rippleColor="#80000000"
app:mrl_rippleOverlay="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/rowIcon"
android:paddingLeft="16dp"
android:src="@drawable/ic_launcher"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="12dp"
android:paddingTop="4dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Medium Text"
android:id="@+id/rowText" />
</LinearLayout>
</com.balysv.materialripple.MaterialRippleLayout>
Upvotes: 1