开发者

Does onTouchEvent() has to extends from MapView?

开发者 https://www.devze.com 2022-12-17 08:40 出处:网络
I want to catch any onTouchEvent() on the mapview. After search lots of questions&answers, I found only when I write my own MapView(MyMapView)and define onTouchEvent, then use this MyMapView in

I want to catch any onTouchEvent() on the mapview.

After search lots of questions&answers, I found only when I write my own MapView(MyMapView)and define onTouchEvent, then use this MyMapView in main 开发者_StackOverflowactivity.

Is it the only way??


It's actually the simplest way. When you extend the MapView there are only a few methods that you need to implement and they are really straight forward.


You can also use overlays. See this my answer to the question here: How to capture location from MapActivity

Not sure if all touch events will be routed to the overlay's onTouchEvent though.

0

精彩评论

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

关注公众号