touch - Android getting ACTION_UP without ACTION_DOWN -
hi want pass touch event parent, if touch has moved, when user clicks want handle within child, tried within child:
private boolean moved = false; @override public boolean ontouchevent(motionevent event) { if (event.getaction() == motionevent.action_down) { super.ontouchevent(event); moved = false; return false; } if (event.getaction() == motionevent.action_move) { moved = true; return false; } if (event.getaction() == motionevent.action_up) { return !moved; } return true; }
but when return false on action_down not action_up
on time action_down occours not know if handle or not
according this official android developer site link (read capturing touch events single view
section)
beware of creating listener returns
false
action_down
event. if this, listener not called subsequentaction_move
,action_up
string of events. because action_down starting point touch events.
Comments
Post a Comment