How do i get the point/coordinate the user clicked on an android view?

后端 未结 1 1705
野的像风
野的像风 2021-01-12 13:33

I have an imageview and when clicked, calls OnClickListener.onClick(View v). How do I get the exact point/coordinate that the user clicked?

Thanks

相关标签:
1条回答
  • 2021-01-12 13:52

    You can't get the coordinate touched in OnClickListerner. Please use OnTouchListener.onTouch(View v, MotionEvent event) instead of it, and you could get the coordinate from the event.

    0 讨论(0)
提交回复
热议问题