I have a ListView
with onItemClick()
method . Now I want to detect a touch motion in the screen . Implementing onTouchEvent()
does not work in this case since I have written already a click listener . So help me how to do it. I need both the on click listener and onTouchEvent()
.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You need to implement the OnTouchListener(View v, MotionEvent event) to check event.getX() and event.getY() when event.ACTION_DOWN and event.ACTION_UP and compare them to know the motion direction.
Note: you must return true to be able to receive the event.ACTION_UP event.