문제

I am overriding both onTouch and onClick. Each is supposed to result in different actions (very important). I don't want a touch to be both a touch and a click: it must be either-or. I am not having much luck. How do I get my app to discriminate between onTouch and onClick? Right now, either I get onTouch by itself or I get both onTouch and onClick together (based on whether I change onTouch to return true or false).

도움이 되었습니까?

해결책

An easy solution is to just use onTouch(). Look for ACTION_UP and ACTION_DOWN. Store the position of the touch in ACTION_DOWN, and in ACTION_UP if the distance between the touch and the stored touch are < X then fire a custom click event, otherwise fire the drag event.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top