简体   繁体   中英

Adding a custom Google map in Android development

Hey I am trying to find a way to create a golf cart map for android devices using the Google API's and Google Maps. I have an API key from google and did the basic tutorial already. I create a custom Google map that I want to implement in the application (all i really had to do was turn the bicycle map on). So what I am trying to do is program my custom map into an android application so people can use it as a GPS while driving on Golf Carts. I would greatly appreciate any advice to get me started because I haven't been able to find out how to do this in the Google API reference.

You will have to create your own extended version of MapView. override the onDraw method when you extend and apply your logic.

http://developer.android.com/guide/topics/ui/custom-components.html :documentation link which can help you creating a custom control.

I would suggest extending the MapActivity class and use Overlays to draw any additional 'Golf' features you want to add eg the location of the user. As they move about in the golf cart you could keep their position static, with respect to the screen eg keep them centered, and scroll the map in whatever direction they are travelling. An additional aspect to keeping them centred is to also keep the map with North pointing upwards, and provide some additional directional feedback to the user such as an arrow showing their direction of travel eg if the user was travelling east, an icon showing their location would be in the center of the screen with an arrow pointing east, with the map scrolling from right to left.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM