如何显示在Android上的自定义地图 [英] How to display a custom map on Android
问题描述
我试图让显示地图一个公园,并在用户点击了地图上的某个位置,该应用程序进入到另一个屏幕的Android应用程序。
I'm trying to make an Android application that displays a map of a Park and when a user taps on a certain location on the map, the application goes to another screen.
问题是,目前我的公园的地图是在.jpg格式。这映射API是最适合我的申请,我怎么会去转换这个.JPG映射到一个由API接受的格式。
Problem is that currently my map of the park is in a .jpg format. Which mapping API is best for my application and how would I go about converting this .jpg map into a format that is accepted by the API.
谢谢!
推荐答案
添加了谷歌地图的覆盖与自定义的地图是pretty容易做到,样品code工作开箱。
Adding an overlay for Google maps with a custom map is pretty easy to do, the sample code works out of the box.
要覆盖你需要有公园的GPS坐标的一个粗略的地图。还有就是样品code使用一个jpg覆盖在这里:<一href=\"https://$c$c.google.com/p/android-maps-extensions/source/browse/google-play-services-samples/src/com/example/mapdemo/GroundOverlayDemoActivity.java?r=fd7175206a82da6d87b773e968d52849b4c107fb\" rel=\"nofollow\">https://$c$c.google.com/p/android-maps-extensions/source/browse/google-play-services-samples/src/com/example/mapdemo/GroundOverlayDemoActivity.java?r=fd7175206a82da6d87b773e968d52849b4c107fb
To overlay the map you need to have a rough idea of the gps coordinates of the park. There is the sample code for overlays using a jpg is here: https://code.google.com/p/android-maps-extensions/source/browse/google-play-services-samples/src/com/example/mapdemo/GroundOverlayDemoActivity.java?r=fd7175206a82da6d87b773e968d52849b4c107fb
克隆整个项目并将其导入到Eclipse中:
Clone the entire project and import it into Eclipse:
git clone https://code.google.com/p/android-maps-extensions/
在你运行它,并安装在设备上,你会希望在这里得到一个API密钥:
的https://$c$c.google.com/apis/console
After you have it running and installed on your device, you will want to get an API key here: https://code.google.com/apis/console
完整说明在这里,如果你遇到问题:
https://developers.google.com/maps/documentation/android/start
Full instructions are here if you get stuck: https://developers.google.com/maps/documentation/android/start
有其他的演示,让您的地图更加有用,例如:
There are other demos to make your map more useful for example:
- 交通信息获取事件/公园
- 如果你想为吸引眼球三维透视
- 有关系的用户的当前位置的GPS公园
- 请叠加不透明或微透明
- 自定义标记,使用户可以通过点击并打开另一个屏幕
这篇关于如何显示在Android上的自定义地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!