Android Ripple effect not appears when click on recyclerview items -
ripple effects on recyclerview appears when click on space area. (photo 1)
when image or textview clicked, effect not appear! problem? (photo 2)
here code: recylcer_item:
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:clickable="true" android:focusable="true" android:background="?attr/selectableitembackground" > <imageview android:layout_width="60dp" android:layout_height="60dp" android:id="@+id/recycler_listrow_icon" android:layout_marginleft="0dp" android:layout_marginright="0dp" android:layout_centervertical="true" android:layout_alignparenttop="true" android:layout_alignparentstart="true" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="name" android:id="@+id/recycler_listrow_text" android:textsize="25sp" android:textcolor="#010101" android:layout_marginleft="10dp" android:layout_marginright="10dp" android:layout_centervertical="true" android:layout_toendof="@+id/recycler_listrow_icon" /> </relativelayout>
try setting both foreground
, background
. , make clickable=true
like this:
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:clickable="true" android:focusable="true" android:foreground="?android:attr/selectableitembackground" android:clickable="true" android:background="?android:selectableitembackground" > <imageview android:layout_width="60dp" android:layout_height="60dp" android:id="@+id/recycler_listrow_icon" android:layout_marginleft="0dp" android:layout_marginright="0dp" android:layout_centervertical="true" android:layout_alignparenttop="true" android:layout_alignparentstart="true" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="name" android:id="@+id/recycler_listrow_text" android:textsize="25sp" android:textcolor="#010101" android:layout_marginleft="10dp" android:layout_marginright="10dp" android:layout_centervertical="true" android:layout_toendof="@+id/recycler_listrow_icon" /> </relativelayout>
Comments
Post a Comment