开发者

How to get x y position where user has touched on screen in android?

Hi I want to get x and y position of sc开发者_如何学编程reen where the user has touched. How can I do that?


It depends a little on the way you're doing your view. Usually you attach an event listener to your view in your onCreate() method. More here

If you have a custom view then you might use a handler instead, which means you override the onTouch() method in your view.

Either way you'll get an event object which has the x and y values.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜