Android Data Binding ListView item fails onClick -
i have listview adapter :
adapter
public class menuadapter extends baseadapter{ private list<viewdatabinding> bindings = new arraylist<>(); public menuadapter(){ firstbinding binding = firstbinding.inflate(inflater); firstmodel model = ...; binding.setmodel(model); bindings.add(binding); secondbinding secondbinding = secondbinding.inflate(inflater); secondmodel secondmodel = ...; binding.setmodel(secondmodel); bindings.add(secondbinding); } ... @override public view getview(int position, view convertview, viewgroup parent) { return bindings.get(position).getroot(); } ... }
first.xml(first layout binding)
<?xml version="1.0" encoding="utf-8"?> <layout xmlns:android="http://schemas.android.com/apk/res/android"> <data> ... </data> <relativelayout android:layout_width="match_parent" android:layout_height="@dimen/menu_row_height" android:background="@color/menu_application_background" > ... <button ... android:onclick="@{model.onclick}" /> </relativelayout> </layout>
actually onclick not working expected...clicking on button, doesn't call onclick model..but after trying scroll list..it calls onclick missed calls (ex. can click on button 3 times in row...but onclick not called. after scrolling listview, onclick called 3 times(missed ones)).
what's wrong here ? solutions?
p.s. setting onitemclicklistener listview not want.
Comments
Post a Comment