本文介绍了我如何获得的x,y坐标为屏幕触摸?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有一种简单的方法来获得X,Y坐标,而我的应用程序运行时,每当有人触摸屏?只是寻找将它们存储在一些整数。
Is there a simple way to obtain the x,y coordinate whenever someone touches the screen while my app is running? Just looking to store them in some integers.
推荐答案
覆盖的onTouchEvent(MotionEvent事件)
,然后调用 event.getX()
和 event.getY()
来获得的,其中用户触摸的坐标位置[他们会花车。
Override onTouchEvent(MotionEvent event)
and then call event.getX()
and event.getY()
to get the coordinate positions of where the user touched [they will be floats].
这篇关于我如何获得的x,y坐标为屏幕触摸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!