Android的 - 在我的谷歌地图的中心显示十字线我的、地图、中心、Android

2023-09-08 08:57:36 作者:争夺战

我有一个谷歌地图和ItemizedOverlay一个应用程序用来显示一些标记(从图形页面官方教程)。我需要你的帮助,这:我想在上面总是显示十字和中心在地图上,即使在地图平移

I have an app with a Google Map and a ItemizedOverlay used to show some markers (From the MapView official tutorial). I need your help with this: I want to show a crosshair always on top and centered on the map, even when the map is panned.

我已阅读本主题:Android - 创建我的谷歌地图的中心的十字线但对如何使用code回答没有解释

I have read this topic: Android - Creating a Crosshair in the Center of My Google Map but there is no explanation on how to use the code answered.

先谢谢了。

推荐答案

步骤#1:无论是覆盖类,从这个问题的答案到你的项目中复制

Step #1: Copy either of the Overlay classes from that answer into your project.

第二步:通过你的图形页面覆盖类的一个实例添加getOverlays()。添加(),就像你添加你自己的 ItemizedOverlay

Step #2: Add an instance of that Overlay class to your MapView via getOverlays().add(), just like you are adding your own ItemizedOverlay.

第三步:有没有步骤#3

Step #3: There is no step #3.

这假定其样本code工作,而我还没有尝试过。

This assumes that their sample code works, and I have not tried it.