android - Recycler Item not giving feedback when clicked -
this row item using on recycler view:
<relativelayout android:id="@+id/requestcard" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingtop="16sp" android:paddingbottom="16sp" android:background="?android:attr/selectableitembackground" android:descendantfocusability="blocksdescendants" android:clickable="true"> <!--<de.hdodenhof.circleimageview.circleimageview--> <!--android:id="@+id/avatar"--> <!--android:layout_width="@dimen/list_item_avatar_size"--> <!--android:layout_height="@dimen/list_item_avatar_size"--> <!--android:layout_marginright="16dp"/>--> <textview android:id="@+id/test" android:text="testing ripple" android:layout_width="match_parent" android:layout_height="wrap_content" android:textappearance="?attr/textappearancelistitem"/> </relativelayout>
and implementation programmatically
int mbackground; private final typedvalue mtypedvalue = new typedvalue(); public itemadapter(context context, listfunctionholder.onlistfunctionitemlistener listfunctionitemlistener, arraylist<contactmodel> models) { layoutinflater = (layoutinflater) context.getsystemservice(context.layout_inflater_service); mcontext = context; context.gettheme().resolveattribute(r.attr.selectableitembackground, mtypedvalue, true); itemlistener = listfunctionitemlistener; contactmodels = models; mbackground = mtypedvalue.resourceid; } @override public conversationholder oncreateviewholder(viewgroup parent, int viewtype) { view view = layoutinflater.inflate(r.layout.zr_people_item_zone_has_image, parent, false); return new conversationholder(this, view, viewtype, itemlistener); }
and using appcompact style:
<style name="apptheme" parent="theme.appcompat.light.noactionbar">
these of suggestions on how can fix issue different thread in , there's still no feedback when item clicked on recycler view. how can achieve feedback on recycler view.
zonecontactloaderadapter zonecontactloaderadapter; public conversationholder(zonecontactloaderadapter zonecontactloaderadapter, view itemview, int viewtype, listfunctionholder.onlistfunctionitemlistener onlistfunctionitemlistener) { super(itemview); // stuff listener = onlistfunctionitemlistener; itemview.setonclicklistener(this); this.zonecontactloaderadapter = zonecontactloaderadapter; @override public void onclick (view v){ zonecontactloaderadapter.notifyitemchanged(this.getlayoutposition()); // listener.onselected(v, this.getlayoutposition()); } }
Comments
Post a Comment