我如何获得点/坐标用户点击一个机器人有何看法?
问题描述:
我有一个ImageView的和点击时,调用 OnClickListener.onClick(视图v)
。我如何得到确切点/坐标,用户点击?
I have an imageview and when clicked, calls OnClickListener.onClick(View v)
. How do I get the exact point/coordinate that the user clicked?
感谢
答
您不能得到协调OnClickListerner感动。 请使用,而不是它OnTouchListener.onTouch(视图V,MotionEvent事件), 并且你可以从该事件的坐标。
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.