java - Listview onTouch within a ListFragment single click not working -


i using fragment extends listfragment, uses arrayadapter in order create dynamic list of custom rows (this working perfectly).

what trying implement ontouch event when user swipes each row left of right something. logic working issue having ontouch event action_up not seem called first time.

@override public void onlistitemclick(listview l, view v, final int position, long id) {     super.onlistitemclick(l, v, position, id);      v.setontouchlistener(new view.ontouchlistener() {         int initialx = 0;         final float slop = viewconfiguration.get(getactivity()).getscaledtouchslop() * 1.5f;          @override         public boolean ontouch(final view v, motionevent event) {             switch(event.getactionmasked()) {                 case motionevent.action_down:                     initialx = (int) event.getx();                      return true;                 case motionevent.action_up:                     // here                      return false;             }              return false;         }     }); } 

i returning true action_down understanding should indicate ontouch event continue processing touch events , in above code action_up when user lifts finger screen, not sure missing here.

further if @ possible bind onclick event onto same view (not essential have workaround if can above working).

you must have used ontouchlistener listener swiping each rows of listview, make sure returning false on action_up event.

parent view receives call when child views have not consumed it. if each rows of list view having ontouchlistener, have propagate event parent returning false.

hope help.


Comments